Piwik\API\Request::getCurrentUrlWithoutGenericFilters PHP Method

getCurrentUrlWithoutGenericFilters() public static method

Returns the current URL without generic filter query parameters.
public static getCurrentUrlWithoutGenericFilters ( array $params ) : string
$params array Query parameter values to override in the new URL.
return string
    public static function getCurrentUrlWithoutGenericFilters($params)
    {
        // unset all filter query params so the related report will show up in its default state,
        // unless the filter param was in $queryParams
        $genericFiltersInfo = DataTableGenericFilter::getGenericFiltersInformation();
        foreach ($genericFiltersInfo as $filter) {
            foreach ($filter[1] as $queryParamName => $queryParamInfo) {
                if (!isset($params[$queryParamName])) {
                    $params[$queryParamName] = null;
                }
            }
        }
        return Url::getCurrentQueryStringWithParametersModified($params);
    }

Usage Example

Example #1
0
 public function configureView(ViewDataTable $view)
 {
     $view->config->self_url = Request::getCurrentUrlWithoutGenericFilters(array('module' => $this->module, 'action' => 'getPageTitles'));
     $view->config->title = $this->name;
     $view->config->addTranslation('label', $this->dimension->getName());
     $view->config->columns_to_display = array('label', 'nb_hits', 'nb_visits', 'bounce_rate', 'avg_time_on_page', 'exit_rate', 'avg_time_generation');
     $this->addPageDisplayProperties($view);
     $this->addBaseDisplayProperties($view);
 }
All Usage Examples Of Piwik\API\Request::getCurrentUrlWithoutGenericFilters