protected function assertSettingHasValue(Setting $setting, $expectedValue, $expectedType = null) { $value = $setting->getValue($setting); $this->assertEquals($expectedValue, $value); if (!is_null($expectedType)) { $this->assertInternalType($expectedType, $value); } }
public function getValue() { $defaultValue = parent::getValue(); // we access value first to make sure permissions are checked $configValue = $this->getValueFromConfig(); if (isset($configValue)) { $defaultValue = $configValue; settype($defaultValue, $this->type); } return $defaultValue; }
protected function init() { $this->urls = new Urls($this->idSite); $this->addSetting($this->urls); $this->excludeKnownUrls = $this->makeExcludeUnknownUrls(); $this->keepPageUrlFragments = $this->makeKeepUrlFragments($this->sitesManagerApi); $this->excludedIps = $this->makeExcludeIps(); $this->excludedParameters = $this->makeExcludedParameters(); $this->excludedUserAgents = $this->makeExcludedUserAgents(); /** * SiteSearch */ $this->siteSearch = $this->makeSiteSearch(); $this->useDefaultSiteSearchParams = $this->makeUseDefaultSiteSearchParams($this->sitesManagerApi); $this->siteSearchKeywords = $this->makeSiteSearchKeywords(); $siteSearchKeywords = $this->siteSearchKeywords->getValue(); $this->useDefaultSiteSearchParams->setDefaultValue(empty($siteSearchKeywords)); $this->siteSearchCategory = $this->makeSiteSearchCategory($this->pluginManager); /** * SiteSearch End */ $this->ecommerce = $this->makeEcommerce(); }
private function formatMetadata(Setting $setting) { $config = $setting->configureField(); $availableValues = $config->availableValues; if (is_array($availableValues)) { $availableValues = (object) $availableValues; } return array('name' => $setting->getName(), 'title' => $config->title, 'value' => $setting->getValue(), 'defaultValue' => $setting->getDefaultValue(), 'type' => $setting->getType(), 'uiControl' => $config->uiControl, 'uiControlAttributes' => $config->uiControlAttributes, 'availableValues' => $availableValues, 'description' => $config->description, 'inlineHelp' => $config->inlineHelp, 'introduction' => $config->introduction, 'condition' => $config->condition); }