You are here

function advagg_hooks_implemented in Advanced CSS/JS Aggregation 8.3

Same name and namespace in other branches
  1. 8.4 advagg.module \advagg_hooks_implemented()
  2. 8.2 advagg.module \advagg_hooks_implemented()
  3. 7.2 advagg.module \advagg_hooks_implemented()

Get back what core asset hooks are implemented.

Return value

array List of hooks and what modules have implemented them.

1 call to advagg_hooks_implemented()
InfoForm::buildForm in src/Form/InfoForm.php
Form constructor.

File

./advagg.module, line 212
Advanced CSS/JS aggregation module.

Code

function advagg_hooks_implemented() {
  $module_handler = \Drupal::moduleHandler();
  $hooks = [
    'js_alter' => [],
    'css_alter' => [],
    'page_attachments_alter' => [],
  ];

  // Cache module_implements as this will load up .inc files.
  $cid = 'advagg_hooks_implemented';
  $cache = \Drupal::cache('advagg')
    ->get($cid);
  if (!empty($cache->data)) {
    return $cache->data;
  }
  foreach ($hooks as $hook => $values) {
    $hooks[$hook] = $module_handler
      ->getImplementations($hook);
  }
  \Drupal::cache('advagg')
    ->set($cid, $hooks, \Drupal::time()
    ->getRequestTime() + 600);
  return $hooks;
}