class SettingManager

Manages discovery and instantiation of Bootstrap theme settings.


  • class \Drupal\bootstrap\Plugin\PluginManager extends \Drupal\Core\Plugin\DefaultPluginManager

Expanded class hierarchy of SettingManager

Related topics

1 file declares its use of SettingManager
Theme.php in src/Theme.php
Contains \Drupal\bootstrap.


class SettingManager extends PluginManager {

   * Constructs a new \Drupal\bootstrap\Plugin\SettingManager object.
   * @param \Drupal\bootstrap\Theme $theme
   *   The theme to use for discovery.
  public function __construct(Theme $theme) {
    parent::__construct($theme, 'Plugin/Setting', 'Drupal\bootstrap\Plugin\Setting\SettingInterface', 'Drupal\bootstrap\Annotation\BootstrapSetting');
    $this->setCacheBackend(\Drupal::cache('discovery'), 'theme:' . $theme->getName() . ':setting', $this->getCacheTags());

   * {@inheritdoc}
  public function getDefinitions($sorted = TRUE) {
    $definitions = parent::getDefinitions(FALSE);
    if ($sorted) {
      $groups = [];
      foreach ($definitions as $plugin_id => $definition) {
        $key = !empty($definition['groups']) ? implode(':', array_keys($definition['groups'])) : '_default';
        $groups[$key][$plugin_id] = $definition;
      $definitions = [];
      foreach ($groups as $settings) {
        uasort($settings, [$this, 'sort']);
        $definitions = array_merge($definitions, $settings);

    return $definitions;

   * Sorts a structured array by either a set 'weight' property or by the ID.
   * @param array $a
   *   First item for comparison.
   * @param array $b
   *   Second item for comparison.
   * @return int
   *   The comparison result for uasort().
  public static function sort(array $a, array $b) {
    if (isset($a['weight']) || isset($b['weight'])) {
      return SortArray::sortByWeightElement($a, $b);
    else {
      return SortArray::sortByKeyString($a, $b, 'id');



Contains filters are case sensitive
Namesort descending Modifiers Type Description
PluginManager::$theme protected property The current theme.
PluginManager::$themeHandler protected property The theme handler to check if theme exists.
PluginManager::$themeManager protected property The theme manager to invoke alter hooks.
PluginManager::alterDefinitions protected function
PluginManager::createInstance public function
PluginManager::getCacheTags public function Retrieves the cache tags used to invalidate caches.
PluginManager::getDefinitionsLike public function Retrieves all definitions where the plugin ID matches a certain criteria.
PluginManager::providerExists protected function
SettingManager::getDefinitions public function Overrides PluginManager::getDefinitions
SettingManager::sort public static function Sorts a structured array by either a set 'weight' property or by the ID.
SettingManager::__construct public function Constructs a new \Drupal\bootstrap\Plugin\SettingManager object. Overrides PluginManager::__construct