function ViewsTestDataViewsExecutionHooks::viewsPreRender
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/ src/ Hook/ ViewsTestDataViewsExecutionHooks.php, line 61
Class
- ViewsTestDataViewsExecutionHooks
- Hook implementations for views_test_data.
Namespace
Drupal\views_test_data\HookCode
public function viewsPreRender(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.