MetaModels\Filter\Setting\Simple::buildFilterUrl PHP Метод

buildFilterUrl() защищенный Метод

Build the filter url based upon the fragments.
protected buildFilterUrl ( array $fragments, string $searchKey ) : string
$fragments array The parameters to be used in the Url.
$searchKey string The param key to handle for "this".
Результат string
    protected function buildFilterUrl($fragments, $searchKey)
    {
        $url = '';
        $found = false;
        // Create base url containing for preserving the current filter on unrelated widgets and modules.
        // The URL parameter concerning us will be masked via %s to be used later on in a sprintf().
        foreach ($fragments as $key => $value) {
            // Skip the magic "language" parameter.
            if ($key == 'language' && $GLOBALS['TL_CONFIG']['addLanguageToUrl']) {
                continue;
            }
            if ($key == $searchKey) {
                if ($key !== 'auto_item') {
                    $url .= '%s';
                } else {
                    $url = '%s' . $url;
                }
                $found = true;
            } else {
                $url = $this->addUrlParameter($url, $key, $value);
            }
        }
        // If we have not found our parameter in the URL, we add it as %s now to be able to populate it via sprintf()
        // below.
        if (!$found) {
            if ($searchKey !== 'auto_item') {
                $url .= '%s';
            } else {
                $url = '%s' . $url;
            }
        }
        return $url;
    }