You are here

function auto_height_page_attachments in jQuery Auto Height 8

Implements hook_page_attachments().

File

./auto_height.module, line 29
Provides dynamic adjustment of column heights, matching the biggest column in each Row.

Code

function auto_height_page_attachments(array &$page) {

  // Get all the classes.
  $config = \Drupal::config('auto_height.settings');
  $class_selectors = $config
    ->get('class_selectors');

  // Comma seperated classes for the js file.
  $js_selectors = implode(',', explode(PHP_EOL, $class_selectors));

  // Export settings
  $page['#attached']['drupalSettings']['auto_height']['selectors'] = $js_selectors;

  // Attach libraries
  $page['#attached']['library'][] = 'auto_height/autoheight';
  $page['#attached']['library'][] = 'auto_height/initialize';
}