public static function RenderStackTest::renderStackPostProcessTest in Render cache 7.2
Helper function to test #post_render_cache.
File
- tests/
src/ Cache/ RenderStackTest.php, line 883 - Contains \Drupal\render_cache\Tests\Cache\RenderStackTest
Class
- RenderStackTest
- @coversDefaultClass \Drupal\render_cache\Cache\RenderStack @group cache
Namespace
Drupal\render_cache\Tests\CacheCode
public static function renderStackPostProcessTest(array $element, array $context) {
$source = $context[0];
$dest = $context[1];
$prc = $context[2];
$stack = $context[3];
$element['#markup'] = str_replace($source, $dest, $element['#markup']);
$element['#cache']['tags'][] = $source;
$element['#attached']['library'][] = array(
'bar',
$dest,
);
$stack
->drupal_add_library('foo', $dest);
if (!empty($prc)) {
$element['#post_render_cache']['\\Drupal\\render_cache\\Tests\\Cache\\RenderStackTest::renderStackPostProcessTest'][] = $prc;
}
return $element;
}