private function makeUseDefaultSiteSearchParams(SitesManager\API $sitesManagerApi) { return $this->makeSetting('use_default_site_search_params', $default = true, FieldConfig::TYPE_BOOL, function (FieldConfig $field) use($sitesManagerApi) { if (Piwik::hasUserSuperUserAccess()) { $title = Piwik::translate('SitesManager_SearchUseDefault', array("<a href='#globalSettings'>", "</a>")); } else { $title = Piwik::translate('SitesManager_SearchUseDefault', array('', '')); } $field->title = $title; $field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX; $searchKeywordsGlobal = $sitesManagerApi->getSearchKeywordParametersGlobal(); $hasParams = (int) (!empty($searchKeywordsGlobal)); $field->condition = $hasParams . ' && sitesearch'; $searchKeywordsGlobal = $sitesManagerApi->getSearchKeywordParametersGlobal(); $searchCategoryGlobal = $sitesManagerApi->getSearchCategoryParametersGlobal(); $field->description = Piwik::translate('SitesManager_SearchKeywordLabel'); $field->description .= ' (' . Piwik::translate('General_Default') . ')'; $field->description .= ': '; $field->description .= $searchKeywordsGlobal; $field->description .= ' & '; $field->description .= Piwik::translate('SitesManager_SearchCategoryLabel'); $field->description .= ': '; $field->description .= $searchCategoryGlobal; $field->transform = function () { return null; // never actually save a value for this }; }); }