Allow other modules to modify $children and $elements before rendering.

Parameters

array $children: An array of children elements.

array $elements: A render array containing:

  • #items: The CSS items as returned by drupal_add_css() and altered by drupal_get_css().
  • #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.

See also

advagg_modify_css_pre_render()

advagg_css_compress_advagg_modify_css_pre_render_alter()

Related topics

2 functions implement hook_advagg_modify_css_pre_render_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

advagg_css_compress_advagg_modify_css_pre_render_alter in advagg_css_compress/advagg_css_compress.module
Implements hook_advagg_modify_css_pre_render_alter().
advagg_mod_advagg_modify_css_pre_render_alter in advagg_mod/advagg_mod.module
Implements hook_advagg_modify_css_pre_render_alter().
1 invocation of hook_advagg_modify_css_pre_render_alter()
advagg_modify_css_pre_render in ./advagg.module
Callback for pre_render so elements can be modified before they are rendered.

File

./advagg.api.php, line 454

Code

function hook_advagg_modify_css_pre_render_alter(array &$children, array &$elements) {
    // Get variables.
    $compressor = variable_get('advagg_css_compress_inline', ADVAGG_CSS_COMPRESS_INLINE);
    // Do nothing if the compressor is disabled.
    if (empty($compressor)) {
        return;
    }
    // Do nothing if the page is not cacheable and inline compress if not
    // cacheable is not checked.
    if (!variable_get('advagg_css_compress_inline_if_not_cacheable', ADVAGG_CSS_COMPRESS_INLINE_IF_NOT_CACHEABLE) && !drupal_page_is_cacheable()) {
        return;
    }
    module_load_include('inc', 'advagg_css_compress', 'advagg_css_compress.advagg');
    if ($compressor == 2) {
        // Compress any inline CSS with YUI.
        foreach ($children as &$values) {
            if (!empty($values['#value'])) {
                advagg_css_compress_yui_cssmin($values['#value']);
            }
        }
        unset($values);
    }
}