You are here

highlight.module in Highlight 8

Same filename and directory in other branches
  1. 5 highlight.module
  2. 6 highlight.module
  3. 7 highlight.module

Hooks for the Highlight module.

File

highlight.module
View source
<?php

/**
 * @file
 * Hooks for the Highlight module.
 */

/**
 * Implements hook_page_attachments().
 */
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'),
  ];
}

Functions