Same name in other branches
  1. 7.x-2.x 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
InfoForm::buildForm in src/Form/InfoForm.php
JsCollectionOptimizer::optimize in src/Asset/JsCollectionOptimizer.php

File

./advagg.module, line 395

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;
}