You are here

function adobe_edge_fonts_page_attachments in @font-your-face 8.3

Implements hook_page_attachments().

File

modules/adobe_edge_fonts/adobe_edge_fonts.module, line 35
Adobe Edge Fonts module file.

Code

function adobe_edge_fonts_page_attachments(&$page) {
  $enabled_fonts =& drupal_static('fontyourface_fonts', []);
  $fonts = [];
  foreach ($enabled_fonts as $font) {
    if ($font->pid->value == 'adobe_edge_fonts') {
      $fonts[] = $font;
    }
  }
  $url = adobe_edge_fonts_generate_font_family_css($fonts);
  if (!empty($url)) {
    $page['#attached']['html_head'][] = [
      [
        '#type' => 'html_tag',
        '#tag' => 'script',
        '#attributes' => [
          'src' => $url,
        ],
      ],
      'fontyourface-adobe-edge-fonts',
    ];
  }
}