<?php /** * @file * This is the External Links module. */ use Drupal\Component\Utility\Html; /** * Implements hook_page_attachments(). */ function extlink_page_attachments(array &$attachments) { $config = \Drupal::config('extlink.settings'); $attachments['#attached']['library'][] = 'extlink/drupal.extlink'; $attachments['#attached']['drupalSettings']['data']['extlink'] = array( 'extTarget' => $config->get('extlink_target', 0), 'extClass' => $config->get('extlink_class', 'ext'), 'extLabel' => Html::escape($config->get('extlink_label', t('(link is external)'))), 'extImgClass' => $config->get('extlink_img_class', 0), 'extSubdomains' => $config->get('extlink_subdomains', 1), 'extExclude' => $config->get('extlink_exclude', ''), 'extInclude' => $config->get('extlink_include', ''), 'extCssExclude' => $config->get('extlink_css_exclude', ''), 'extCssExplicit' => $config->get('extlink_css_explicit', ''), 'extAlert' => $config->get('extlink_alert', 0), 'extAlertText' => $config->get('extlink_alert_text', t('This link will take you to an external web site. We are not responsible for their content.')), 'mailtoClass' => $config->get('extlink_mailto_class', 'mailto'), 'mailtoLabel' => Html::escape($config->get('extlink_mailto_label', t('(link sends e-mail)'))), ); }