You are here

public function SiteHeaderBlock::getCacheContexts in Opigno dashboard 3.x

Overrides ContextAwarePluginTrait::getCacheContexts

1 call to SiteHeaderBlock::getCacheContexts()
SiteHeaderBlock::build in src/Plugin/Block/SiteHeaderBlock.php
Builds and returns the renderable array for this block plugin.

File

src/Plugin/Block/SiteHeaderBlock.php, line 185

Class

SiteHeaderBlock
The site header block.

Namespace

Drupal\opigno_dashboard\Plugin\Block

Code

public function getCacheContexts() {
  $contexts = Cache::mergeContexts(parent::getCacheContexts(), [
    'url.path.is_current_user_page',
    'url.path',
  ]);
  if ($this->user instanceof UserInterface) {
    $contexts = Cache::mergeContexts($contexts, [
      'user',
    ]);
  }
  return $contexts;
}