You are here

public function Theme::drupalSettings in Express 8

Retrieves the theme's settings array appropriate for drupalSettings.

Return value

array The theme settings for drupalSettings.

File

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

Class

Theme
Defines a theme object.

Namespace

Drupal\bootstrap

Code

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;
}