Callback for pre_render so elements can be modified before they are rendered.

Paramètres

array $elements: A render array containing:

  • #items: The JavaScript items as returned by drupal_add_js() and altered by drupal_get_js().
  • #group_callback: A function to call to group #items. Following this function, #aggregate_callback is called to aggregate items within the same group into a single file.
  • #aggregate_callback: A function to call to aggregate the items within the groups arranged by the #group_callback function.

Return value

array A render array that will render to a string of JavaScript tags.

2 string references to 'advagg_modify_js_pre_render'
advagg_element_info_alter dans ./advagg.module
Implements hook_element_info_alter().
advagg_install_fast_checks dans ./advagg.install
Run various checks that are fast.

Fichier

./advagg.module, line 1519

Code

function advagg_modify_js_pre_render(array $elements) {
    // Get the children elements.
    $children = array_intersect_key($elements, array_flip(element_children($elements)));
    // Allow other modules to modify $children and $elements before they are
    // rendered.
    // Call hook_advagg_modify_js_pre_render_alter()
    drupal_alter('advagg_modify_js_pre_render', $children, $elements);
    // Remove old children elements.
    foreach ($children as $key => $value) {
        if (isset($elements[$key])) {
            unset($elements[$key]);
        }
    }
    // Add in new children elements.
    $elements += $children;
    return $elements;
}