You are here

function advagg_current_hooks_hash_array in Advanced CSS/JS Aggregation 8.2

Same name and namespace in other branches
  1. 7.2 advagg.module \advagg_current_hooks_hash_array()

Get an array of all hooks and settings that affect aggregated files contents.

Return value

array ['variables' => [], 'hooks' => []]

4 calls to advagg_current_hooks_hash_array()
advagg_get_current_hooks_hash in ./advagg.module
Get the hash of all hooks and settings that affect aggregated files contents.
CssCollectionOptimizer::optimize in src/Asset/CssCollectionOptimizer.php
The cache file name is retrieved on a page load via a lookup variable that contains an associative array. The array key is the hash of the file names in $css while the value is the cache file name. The cache file is generated in two cases. First, if…
InfoForm::buildForm in src/Form/InfoForm.php
Form constructor.
JsCollectionOptimizer::optimize in src/Asset/JsCollectionOptimizer.php
The cache file name is retrieved on a page load via a lookup variable that contains an associative array. The array key is the hash of the names in $files while the value is the cache file name. The cache file is generated in two cases. First, if…

File

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

Code

function advagg_current_hooks_hash_array() {
  $aggregate_settings =& drupal_static(__FUNCTION__);
  if (isset($aggregate_settings)) {
    return $aggregate_settings;
  }
  $config = \Drupal::config('advagg.settings');

  // Put all enabled hooks and settings into a big array.
  $aggregate_settings = [
    'variables' => [
      'advagg' => $config
        ->get(),
    ],
    'hooks' => advagg_hooks_implemented(FALSE),
  ];

  // Add in language if locale is enabled.
  if (\Drupal::moduleHandler()
    ->moduleExists('locale')) {
    $aggregate_settings['variables']['language'] = isset(\Drupal::languageManager()
      ->getCurrentLanguage()->language) ? \Drupal::languageManager()
      ->getCurrentLanguage()->language : '';
  }

  // Add the base url if so desired to.
  if ($config
    ->get('include_base_url')) {
    $aggregate_settings['variables']['base_url'] = $GLOBALS['base_url'];
  }

  // Allow other modules to add in their own settings and hooks.
  // Call hook_advagg_current_hooks_hash_array_alter().
  \Drupal::moduleHandler()
    ->alter('advagg_current_hooks_hash_array', $aggregate_settings);
  return $aggregate_settings;
}