function public function Theme::drupalSettings

8.x-3.x Theme.php public Theme::drupalSettings()

Retrieves the theme's settings array appropriate for drupalSettings.

Return value

array The theme settings for drupalSettings.

Class

Theme
Defines a theme object.

Namespace

Drupal\bootstrap

Source src/Theme.php (line 244)

public function drupalSettings() {
  // Immediately return if theme is not Bootstrap based.
  if (!$this->isBootstrap()) {
    return [];
  }

  $cache = $this->getCache('drupalSettings');
  $drupal_settings = $cache->getAll();
  if (!$drupal_settings) {
    foreach ($this->getSettingPlugin() as $name => $setting) {
      if ($setting->drupalSettings()) {
        $drupal_settings[$name] = TRUE;
      }
    }
    $cache->setMultiple($drupal_settings);
  }

  $drupal_settings = array_intersect_key($this->settings()->get(), $drupal_settings);

  // Indicate that theme is in dev mode.
  if ($this->isDev()) {
    $drupal_settings['dev'] = TRUE;
  }

  return $drupal_settings;
}