function views_test_data_views_pre_render
Same name in other branches
- 9 core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc \views_test_data_views_pre_render()
- 8.9.x core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc \views_test_data_views_pre_render()
- 11.x core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc \views_test_data_views_pre_render()
Implements hook_views_pre_render().
See also
\Drupal\views\Tests\Plugin\CacheTest
\Drupal\views\Tests\Plugin\RenderTest
File
-
core/
modules/ views/ tests/ modules/ views_test_data/ views_test_data.views_execution.inc, line 51
Code
function views_test_data_views_pre_render(ViewExecutable $view) {
\Drupal::state()->set('views_hook_test_views_pre_render', TRUE);
if (isset($view) && $view->storage
->id() == 'test_cache_header_storage') {
$view->element['#attached']['library'][] = 'views_test_data/test';
$view->element['#attached']['drupalSettings']['foo'] = 'bar';
$view->element['#attached']['placeholders']['non-existing-placeholder-just-for-testing-purposes']['#lazy_builder'] = [
'Drupal\\views_test_data\\Controller\\ViewsTestDataController::placeholderLazyBuilder',
[
'bar',
],
];
$view->element['#cache']['tags'][] = 'views_test_data:1';
$view->build_info['pre_render_called'] = TRUE;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.