function highlight_page_attachments in Highlight 8
Implements hook_page_attachments().
File
- ./
highlight.module, line 11 - Hooks for the Highlight module.
Code
function highlight_page_attachments(array &$attachments) {
$config = \Drupal::config('highlight.settings');
$attachments['#attached']['library'][] = 'highlight/highlight';
$attachments['#attached']['drupalSettings']['highlight'] = [
'area' => $config
->get('area'),
'class' => $config
->get('class'),
'color' => $config
->get('color'),
'textColor' => $config
->get('text_color'),
'wordsonly' => $config
->get('wordsonly'),
'patterns' => implode("\n", $config
->get('patterns')),
'referrerPatterns' => implode("\n", $config
->get('patterns_referrer')),
'stopwords' => $config
->get('stopwords'),
];
}