You are here

function site_banner_page_attachments_alter in Site Banner 1.0.x

Same name and namespace in other branches
  1. 8 site_banner.module \site_banner_page_attachments_alter()
  2. 2.0.x site_banner.module \site_banner_page_attachments_alter()

Implements hook__page_attachments_alter().

File

./site_banner.module, line 13
Site banner module.

Code

function site_banner_page_attachments_alter(array &$page) {
  $config = \Drupal::configFactory()
    ->get('site_banner.settings');
  $status = $config
    ->get('status') ?? FALSE;
  $header = $config
    ->get('show_header') ?? FALSE;
  $footer = $config
    ->get('show_footer') ?? FALSE;
  if ($status && ($header || $footer)) {
    $page['#attached']['library'][] = 'site_banner/site-banner.print-css';
    $page['#attached']['library'][] = 'site_banner/site-banner.screen-css';
  }
}