You are here

public function Theme::getSettingPlugin in Express 8

Retrieves a theme's setting plugin instance(s).

Parameters

string $name: Optional. The name of a specific setting plugin instance to return.

Return value

\Drupal\bootstrap\Plugin\Setting\SettingInterface|\Drupal\bootstrap\Plugin\Setting\SettingInterface[]|NULL If $name was provided, it will either return a specific setting plugin instance or NULL if not set. If $name was omitted it will return an array of setting plugin instances, keyed by their name.

2 calls to Theme::getSettingPlugin()
Theme::drupalSettings in themes/contrib/bootstrap/src/Theme.php
Retrieves the theme's settings array appropriate for drupalSettings.
Theme::getSettingPlugins in themes/contrib/bootstrap/src/Theme.php
Retrieves the theme's setting plugin instances.

File

themes/contrib/bootstrap/src/Theme.php, line 546
Contains \Drupal\bootstrap.

Class

Theme
Defines a theme object.

Namespace

Drupal\bootstrap

Code

public function getSettingPlugin($name = NULL) {
  $settings = [];

  // Only continue if the theme is Bootstrap based.
  if ($this
    ->isBootstrap()) {
    $setting_manager = new SettingManager($this);
    foreach (array_keys($setting_manager
      ->getDefinitions()) as $setting) {
      $settings[$setting] = $setting_manager
        ->createInstance($setting);
    }
  }

  // Return a specific setting plugin.
  if (isset($name)) {
    return isset($settings[$name]) ? $settings[$name] : NULL;
  }

  // Return all setting plugins.
  return $settings;
}