You are here

public function TocJsBlock::getCacheTags in Toc.js 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Block/TocJsBlock.php \Drupal\toc_js\Plugin\Block\TocJsBlock::getCacheTags()

The cache tags associated with this object.

When this object is modified, these cache tags will be invalidated.

Return value

string[] A set of cache tags.

Overrides ContextAwarePluginBase::getCacheTags

File

src/Plugin/Block/TocJsBlock.php, line 315

Class

TocJsBlock
Provides a 'SocialSimpleBlock' block.

Namespace

Drupal\toc_js\Plugin\Block

Code

public function getCacheTags() {

  /** @var \Drupal\node\NodeInterface $node */
  if ($node = $this->currentRouteMatch
    ->getParameter('node')) {
    return Cache::mergeTags(parent::getCacheTags(), $node
      ->getCacheTags());
  }
  elseif ($taxonomy_term = $this->currentRouteMatch
    ->getParameter('taxonomy_term')) {
    return Cache::mergeTags(parent::getCacheTags(), $taxonomy_term
      ->getCacheTags());
  }
  else {
    return parent::getCacheTags();
  }
}