Same name in other branches
  1. 5.0.x advagg.module \advagg_hooks_implemented()
  2. 8.x-2.x advagg.module \advagg_hooks_implemented()
  3. 8.x-3.x advagg.module \advagg_hooks_implemented()
  4. 8.x-4.x advagg.module \advagg_hooks_implemented()

Get back what hooks are implemented.

Paramètres

bool $all: If TRUE get all hooks related to css/js files. if FALSE get only the subset of hooks that alter the filename/contents.

Return value

array List of hooks and what modules have implemented them.

2 calls to advagg_hooks_implemented()
advagg_admin_info_form dans ./advagg.admin.inc
Form builder; Show info about advagg and advagg settings.
advagg_current_hooks_hash_array dans ./advagg.module
Get an array of all hooks and settings that affect aggregated files contents.

Fichier

./advagg.module, line 3552

Code

function advagg_hooks_implemented($all = TRUE) {
    // Get hooks in use.
    $hooks = array(
        'advagg_get_css_file_contents_pre_alter' => array(),
        'advagg_get_css_file_contents_alter' => array(),
        'advagg_get_css_aggregate_contents_alter' => array(),
        'advagg_get_js_file_contents_alter' => array(),
        'advagg_get_js_aggregate_contents_alter' => array(),
        'advagg_save_aggregate_pre_alter' => array(),
        'advagg_save_aggregate_alter' => array(),
        'advagg_current_hooks_hash_array_alter' => array(),
        'advagg_get_root_files_dir_alter' => array(),
        'advagg_context_alter' => array(),
    );
    if ($all) {
        $hooks += array(
            'advagg_build_aggregate_plans_alter' => array(),
            'advagg_build_aggregate_plans_post_alter' => array(),
            'advagg_changed_files' => array(),
            'advagg_css_groups_alter' => array(),
            'advagg_js_groups_alter' => array(),
            'advagg_modify_css_pre_render_alter' => array(),
            'advagg_modify_js_pre_render_alter' => array(),
            'advagg_get_info_on_files_alter' => array(),
            'advagg_hooks_implemented_alter' => array(),
            'advagg_removed_aggregates' => array(),
            'advagg_scan_for_changes' => array(),
            'advagg_missing_root_file' => array(),
            'js_alter' => array(),
            'css_alter' => array(),
        );
    }
    // Call hook_advagg_hooks_implemented_alter().
    drupal_alter('advagg_hooks_implemented', $hooks, $all);
    // Cache module_implements as this will load up .inc files.
    $serialize_function = variable_get('advagg_serialize', ADVAGG_SERIALIZE);
    $cid = 'advagg_hooks_implemented:' . (int) $all . ':' . drupal_hash_base64($serialize_function($hooks));
    $cache = cache_get($cid, 'cache_bootstrap');
    if (!empty($cache->data)) {
        $hooks = $cache->data;
    }
    else {
        foreach ($hooks as $hook => $values) {
            $hooks[$hook] = module_implements($hook);
            // Also check themes as drupal_alter() allows for themes to alter things.
            $theme_keys = array_keys(list_themes());
            if (!empty($theme_keys)) {
                foreach ($theme_keys as $theme_key) {
                    $function = $theme_key . '_' . $hook;
                    if (function_exists($function)) {
                        $hooks[$hook][] = $theme_key;
                    }
                }
            }
        }
        cache_set($cid, $hooks, 'cache_bootstrap', CACHE_TEMPORARY);
    }
    return $hooks;
}