Adds snippets so that the SnippetParser has snippets to parse and render.

@param array $settings    an array of snippets
182425
public function addSnippets(array $snippets = null) {

        // register default snippets
        $this->add(new DefaultSnippets());

        if(!is_null($snippets)) {
            foreach ($snippets as $snippet=>$definition) {
                if ($definition instanceof Snippets) {
                    $this->add($definition);
                } else {
                    $this->add($snippet, $definition);
                }
            }
        }
    }
1070478
public function setSettings( $settings )
    {
        if ( ! empty( $settings ) )
        {
            foreach ( $settings as $name => $value )
            {
                $this->setSetting( $name, $value );
            }
        }

        return $this;
    }
928422
public function injectSettings(array $settings): void
    {
        if (isset($settings['security']['authentication']['authenticationStrategy'])) {
            $authenticationStrategyName = $settings['security']['authentication']['authenticationStrategy'];
            switch ($authenticationStrategyName) {
                case 'allTokens':
                    $this->authenticationStrategy = Context::AUTHENTICATE_ALL_TOKENS;
                    break;
                case 'oneToken':
                    $this->authenticationStrategy = Context::AUTHENTICATE_ONE_TOKEN;
                    break;
                case 'atLeastOneToken':
                    $this->authenticationStrategy = Context::AUTHENTICATE_AT_LEAST_ONE_TOKEN;
                    break;
                case 'anyToken':
                    $this->authenticationStrategy = Context::AUTHENTICATE_ANY_TOKEN;
                    break;
                default:
                    throw new Exception('Invalid setting "' . $authenticationStrategyName . '" for security.authentication.authenticationStrategy', 1291043022);
            }
        }
    }
803304
public function renderSettings($setting)
    {
        // Set the setting value if any.
        $value = get_option($setting->getName(), null);

        if (! is_null($value)) {
            $setting->setValue($value);
        }

        $view = sprintf('%s.%s', $this->ui()->getTheme(), $setting->getView(false));

        echo $this->ui()->factory()->make($view)->with([
            '__field' => $setting,
            '__page' => $this
        ])->render();
    }
1309967
protected function addModelSettings(array &$settings)
    {
        $empty = [];
        if (!$this->_fieldDefinition['gtf_required'] || $this->_fieldDefinition['gtf_field_default'] === null) {
            $empty = $this->util->getTranslated()->getEmptyDropdownArray();
        }

        $multi = explode(parent::FIELD_SEP, $this->_fieldDefinition['gtf_field_values']);

        $settings['elementClass'] = 'Select';
        $settings['multiOptions'] = $empty + array_combine($multi, $multi);
    }
407002
public function checkSettings($settings)
    {
        assert('is_array($settings)');

        if (!is_array($settings) || empty($settings)) {
            $errors = array('invalid_syntax');
        } else {
            $errors = array();
            if (!$this->_spValidationOnly) {
                $idpErrors = $this->checkIdPSettings($settings);
                $errors = array_merge($idpErrors, $errors);
            }
            $spErrors = $this->checkSPSettings($settings);
            $errors = array_merge($spErrors, $errors);

            $compressErrors = $this->checkCompressionSettings($settings);
            $errors = array_merge($compressErrors, $errors);
        }

        return $errors;
    }
520049
public function setSelectizeOptions(array $settings)
    {
        $this->selectizeOptions = array_merge(
            $this->defaultSelectizeOptions(),
            $this->parseSelectizeOptions($settings)
        );

        return $this;
    }
941158
protected function parseCompatibleSettings(array $settings)
    {
        $settings = collect($settings)->collapse()->all();

        foreach ($settings as $setting) {
            if ($setting instanceof CanHandlePageSettings) {
                $setting->settingGet();
            }
        }
    }
294658
public function injectSettings(array $settings)
    {
        if (isset($settings['security']['authentication']['authenticationStrategy'])) {
            $authenticationStrategyName = $settings['security']['authentication']['authenticationStrategy'];
            switch ($authenticationStrategyName) {
                case 'allTokens':
                    $this->authenticationStrategy = self::AUTHENTICATE_ALL_TOKENS;
                    break;
                case 'oneToken':
                    $this->authenticationStrategy = self::AUTHENTICATE_ONE_TOKEN;
                    break;
                case 'atLeastOneToken':
                    $this->authenticationStrategy = self::AUTHENTICATE_AT_LEAST_ONE_TOKEN;
                    break;
                case 'anyToken':
                    $this->authenticationStrategy = self::AUTHENTICATE_ANY_TOKEN;
                    break;
                default:
                    throw new Exception('Invalid setting "' . $authenticationStrategyName . '" for security.authentication.authenticationStrategy', 1291043022);
            }
        }

        if (isset($settings['security']['csrf']['csrfStrategy'])) {
            $csrfStrategyName = $settings['security']['csrf']['csrfStrategy'];
            switch ($csrfStrategyName) {
                case 'onePerRequest':
                    $this->csrfProtectionStrategy = self::CSRF_ONE_PER_REQUEST;
                    break;
                case 'onePerSession':
                    $this->csrfProtectionStrategy = self::CSRF_ONE_PER_SESSION;
                    break;
                case 'onePerUri':
                    $this->csrfProtectionStrategy = self::CSRF_ONE_PER_URI;
                    break;
                default:
                    throw new Exception('Invalid setting "' . $csrfStrategyName . '" for security.csrf.csrfStrategy', 1291043024);
            }
        }
    }
603907
protected function setSettings(array $settings): void
    {
        $this->server->set(array_merge($this->defaultSettings, $this->settings, $settings));
    }
355796
public function setSettings(array $settings = []) : self
    {
        $this->settings = array_merge($this->settings, $settings);
        // loop through checking each setting
        foreach ($this->allowedSettings as $name => $allowed) {
            $this->validateSettings->__invoke($name, $this->settings[$name], $allowed);
        }

        return $this;
    }
1326783
public function addSnippet($sSnptName)
    {
        $oSnpt                      = ViewFactory::createSnippet($sSnptName);
        $this->snippets[$sSnptName] = $oSnpt;
    }
747559
private function setCachedSettings(Collection $settings)
    {
        $expiresAt = Carbon::now()->addMinutes(15);
        $settings  = $settings->toArray();

        Cache::put(self::CACHE_NAME, $settings, $expiresAt);

        $this->fireEvent('cache_updated', array($settings));
    }
847489
public function update(array $settings)
    {
        foreach ($settings as $key => $value) {
            $this->getSettingOrFail($key);
        }

        $this->backend->setSettings($settings);
    }
1029240
private function setSettings($settings)
    {
        if ($settings) {
            foreach ($this->settings as $key => &$value) {
                if (!empty($settings->{$key}) && $settings->{$key}) {
                    $value = $settings->{$key};
                }
            }
        }
    }
1294021
public function mock(array $settings = array())
    {
        $this->mocked['REQUEST_TIME'] = time();
        $settings = array_merge($this->mocked, $settings);

        $this->parse($settings);
    }
26126
public static function configure($settings)
    {
        if (isset($settings['client_id'])) {
            self::configureOAuth($settings);
        } else {
            self::configureBasicAuth($settings);
        }
    }