You are here

function outdatedbrowser_page_attachments in Outdated Browser 8

Implements hook_page_attachments().

File

./outdatedbrowser.module, line 12
Outdated Browser module file.

Code

function outdatedbrowser_page_attachments(array &$attachments) {
  if (!_outdatedbrowser_is_active()) {
    return;
  }
  $config = \Drupal::config('outdatedbrowser.settings');
  $js_settings = array(
    'bgColor' => $config
      ->get('bgcolor'),
    'color' => $config
      ->get('color'),
    'lowerThan' => $config
      ->get('lowerthan'),
    'languagePath' => file_create_url(outdatedbrowser_get_language_file_path()),
  );
  $attachments['#attached']['drupalSettings']['outdatedbrowser'] = $js_settings;
  $attachments['#attached']['library'][] = 'outdatedbrowser/drupal';
}