You are here

function render_cache_process_attached_callbacks in Render cache 7

Invokes attached post-render callbacks.

This function can not be named "render_cache_post_render" because that is the name of the #attached element. Any function with the name of an #attached element will be invoked to process it from drupal_process_attached().

Parameters

array &$element: The renderable element to check for and run post-render callbacks on.

string $id: An identifier for this render-cacheable elements.

2 calls to render_cache_process_attached_callbacks()
render_cache_hijack_context_reaction_block::block_list_build in modules/render_cache_context/context/plugins/render_cache_hijack_context_reaction_block.inc
A caching version of block_list() .
_render_cache_post_render in ./render_cache.module

File

./render_cache.module, line 216
Hook implementations and frequently used functions for render cache module.

Code

function render_cache_process_attached_callbacks(&$element, $id) {
  if (isset($element['#markup']) && !empty($element['#attached']['render_cache_post_render'])) {
    foreach ($element['#attached']['render_cache_post_render'] as $function) {

      // Fail fatally if the function has not been defined.
      $element['#markup'] = call_user_func($function, $element['#markup'], $id);
    }
    unset($element['#attached']['render_cache_post_render']);
  }
}