function collapsiblock_page_attachments_alter in Collapsiblock 8.2
Same name and namespace in other branches
- 4.x collapsiblock.module \collapsiblock_page_attachments_alter()
- 3.x collapsiblock.module \collapsiblock_page_attachments_alter()
Implements hook_page_attachments_alter().
Attach our library and global settings.
File
- ./
collapsiblock.module, line 26 - Make blocks collapsible.
Code
function collapsiblock_page_attachments_alter(array &$attachments) {
$attachments['#attached']['library'][] = 'collapsiblock/core';
$settings = \Drupal::config('collapsiblock.settings');
$collapsiblock = [
'active_pages' => $settings
->get('active_pages'),
'slide_type' => $settings
->get('slide_type'),
'slide_speed' => $settings
->get('slide_speed'),
];
$attachments['#attached']['drupalSettings']['collapsiblock'] = $collapsiblock;
}