function closeblock_page_attachments in Close Block 8
Implements hook_page_attachments().
File
- ./
closeblock.module, line 18 - Module's hooks implementations.
Code
function closeblock_page_attachments(array &$attachments) {
$permission = \Drupal::currentUser()
->hasPermission('close block');
if ($permission) {
$factory = \Drupal::configFactory()
->getEditable('closeblock.settings');
foreach ($factory
->get() as $key => $item) {
$attachments['#attached']['drupalSettings']['closeBlockSettings'][$key] = $item;
}
}
}