You are here

ckeditor_accordion.module in CKEditor Accordion 8

Same filename and directory in other branches
  1. 7 ckeditor_accordion.module

Functions to support creating CKEditor Accordion.

File

ckeditor_accordion.module
View source
<?php

/**
 * @file
 * Functions to support creating CKEditor Accordion.
 */

/**
 * Implements hook_page_attachments_alter().
 */
function ckeditor_accordion_page_attachments_alter(array &$page) {
  $config = \Drupal::config('ckeditor_accordion.settings');

  // Attaches css assets globally.
  $page['#attached']['library'][] = 'ckeditor_accordion/accordion_style';

  // Pass settings to JavaScript.
  $page['#attached']['drupalSettings']['ckeditorAccordion']['accordionStyle']['collapseAll'] = $config
    ->get('collapse_all');
  $page['#attached']['drupalSettings']['ckeditorAccordion']['accordionStyle']['keepRowsOpen'] = $config
    ->get('keep_rows_open');
}