localgovdrupal / localgov_subsites_extras

Create menu-driven subsites. Add any content to a subsite and generate a menu to navigate to it.
GNU General Public License v2.0
1 stars 0 forks source link

Subsites cache context #24

Closed Polynya closed 4 months ago

Polynya commented 5 months ago

Add cache context for subsites, for example, so that blocks can be cached separately for the main website and a subsite:

/**
 * Implements hook_block_view_BASE_BLOCK_ID_alter().
 */
function example_block_view_system_branding_block_alter(array &$build, BlockPluginInterface $block) {
  $build['#cache']['contexts'][] = 'subsites';
}
Polynya commented 5 months ago

https://github.com/localgovdrupal/localgov_subsites_extras/pull/23

markconroy commented 4 months ago

The attached PR is merged, so closing this issue.