function view_mode_page_block_build_alter in View Mode Page 3.2.x
Same name and namespace in other branches
- 8.3 view_mode_page.module \view_mode_page_block_build_alter()
- 4.0.x view_mode_page.module \view_mode_page_block_build_alter()
Implements hook_block_build_alter().
Adds additional cache_contexts to the system_main_block, to prevent incorrect caching of a single view_mode (when using a path alias).
File
- ./
view_mode_page.module, line 38 - Contains view_mode_page module.
Code
function view_mode_page_block_build_alter(array &$build, BlockPluginInterface $block) {
if ($block
->getBaseId() == 'system_main_block') {
$build['#cache']['contexts'][] = 'url.path';
}
}