Same name in other branches
  1. 7.x-1.x advagg.module \advagg_element_info_alter()

Implements hook_element_info_alter().

1 call to advagg_element_info_alter()
advagg_get_js dans ./advagg.module
Returns a themed presentation of all JavaScript code for the current page.

Fichier

./advagg.module, line 1038

Code

function advagg_element_info_alter(&$type) {
    // Replace drupal_pre_render_styles with advagg_pre_render_styles.
    $type['styles']['#items'] = array();
    if (!isset($type['styles']['#pre_render'])) {
        $type['styles']['#pre_render'] = array();
    }
    $key = array_search('drupal_pre_render_styles', $type['styles']['#pre_render']);
    if ($key !== FALSE) {
        $type['styles']['#pre_render'][$key] = 'advagg_pre_render_styles';
    }
    else {
        $type['styles']['#pre_render'][] = 'advagg_pre_render_styles';
    }
    // Allow for other code to easily change the render with alter hooks.
    $type['styles']['#pre_render'][] = 'advagg_modify_css_pre_render';
    $type['styles']['#group_callback'] = 'drupal_group_css';
    // Swap in our own aggregation callback.
    $type['styles']['#aggregate_callback'] = '_advagg_aggregate_css';
    $type['styles']['#type'] = 'styles';
    // Replace drupal_pre_render_scripts with advagg_pre_render_scripts.
    $type['scripts']['#items'] = array();
    if (!isset($type['scripts']['#pre_render'])) {
        $type['scripts']['#pre_render'] = array();
    }
    $key_drupal = array_search('drupal_pre_render_scripts', $type['scripts']['#pre_render']);
    $key_omega = array_search('omega_pre_render_scripts', $type['scripts']['#pre_render']);
    $key_aurora = array_search('aurora_pre_render_scripts', $type['scripts']['#pre_render']);
    if ($key_drupal !== FALSE) {
        $type['scripts']['#pre_render'][$key_drupal] = 'advagg_pre_render_scripts';
    }
    elseif ($key_omega !== FALSE) {
        $type['scripts']['#pre_render'][$key_omega] = 'advagg_pre_render_scripts';
    }
    elseif ($key_aurora !== FALSE) {
        $type['scripts']['#pre_render'][$key_aurora] = 'advagg_pre_render_scripts';
    }
    else {
        $type['scripts']['#pre_render'][] = 'advagg_pre_render_scripts';
    }
    // Allow for other code to easily change the render with alter hooks.
    $type['scripts']['#pre_render'][] = 'advagg_modify_js_pre_render';
    $type['scripts']['#group_callback'] = 'advagg_group_js';
    // Swap in our own aggregation callback.
    $type['scripts']['#aggregate_callback'] = '_advagg_aggregate_js';
    $type['scripts']['#type'] = 'scripts';
    // Copy html_tag to html_script_tag.
    $type['html_script_tag'] = $type['html_tag'];
    $type['html_script_tag']['#theme'] = 'html_script_tag';
    $type['html_script_tag']['#type'] = 'html_script_tag';
}