You are here

function _advagg_mod_pre_render_styles in Advanced CSS/JS Aggregation 7.2

A #pre_render callback to inline all CSS on this page.

Parameters

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 to enable the use of fewer tags by aggregating files and/or using multiple @import statements within a single tag.
  • '#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 XHTML CSS tags.

See also

drupal_get_css()

1 string reference to '_advagg_mod_pre_render_styles'
advagg_mod_element_info_alter in advagg_mod/advagg_mod.module
Implements hook_element_info_alter().

File

advagg_mod/advagg_mod.module, line 2755
Advanced aggregation modifier module.

Code

function _advagg_mod_pre_render_styles(array $elements) {
  if (!module_exists('advagg') || !advagg_enabled()) {
    return $elements;
  }
  if (advagg_mod_inline_page() || advagg_mod_inline_page_css()) {
    advagg_mod_inline_css($elements['#items']);
  }
  elseif (variable_get('advagg_mod_css_defer_skip_first_file', ADVAGG_MOD_CSS_DEFER_SKIP_FIRST_FILE) == 4) {
    list(, , , , , , , , , , $css_defer) = advagg_mod_get_lists(array(), $elements['#items']);
    $css_defer_admin = variable_get('advagg_mod_css_defer_admin', ADVAGG_MOD_CSS_DEFER_ADMIN);
    if (advagg_mod_css_defer_page() && !empty($css_defer) && (!empty($css_defer_admin) || !path_is_admin(current_path()))) {
      advagg_mod_inline_css($elements['#items'], 0, variable_get('advagg_mod_css_defer_inline_size_limit', ADVAGG_MOD_CSS_DEFER_INLINE_SIZE_LIMIT));
    }
  }
  return $elements;
}