protected function buildFilterUrl($fragments, $searchKey)
    {
        // @codingStandardsIgnoreStart
        @trigger_error(
            sprintf('"%1$s" has been deprecated in favor of the "FilterUrlBuilder"', __METHOD__),
            E_USER_DEPRECATED
        );
        // @codingStandardsIgnoreEnd

        $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;
    }