function claro_page_attachments_alter

Same name in other branches
  1. 11.x core/themes/claro/claro.theme \claro_page_attachments_alter()

Implements hook_page_attachments_alter().

File

core/themes/claro/claro.theme, line 45

Code

function claro_page_attachments_alter(array &$attachments) {
    $theme_path = \Drupal::request()->getBasePath() . '/' . \Drupal::service('extension.list.theme')->getPath('claro');
    $query_string = \Drupal::service('asset.query_string')->get();
    // Attach non-JavaScript specific CSS via a noscript tag to prevent unwanted
    // layout shifts.
    $attachments['#attached']['html_head'][] = [
        [
            '#tag' => 'link',
            '#noscript' => TRUE,
            '#attributes' => [
                'rel' => 'stylesheet',
                'href' => $theme_path . '/css/components/dropbutton-noscript.css?' . $query_string,
            ],
        ],
        'dropbutton_noscript',
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.