You are here

public function QuickNodeBlock::getCacheTags in Quick Node Block 8

Cache block.

Overrides ContextAwarePluginBase::getCacheTags

File

src/Plugin/Block/QuickNodeBlock.php, line 260

Class

QuickNodeBlock
Provides a Node Block with his display.

Namespace

Drupal\quick_node_block\Plugin\Block

Code

public function getCacheTags() {
  $config = $this
    ->getConfiguration();
  if (isset($config['quick_node'])) {
    preg_match("/.+\\s\\(([^\\)]+)\\)/", $config['quick_node'], $matches);
    $nid = $matches[1];
    return Cache::mergeTags(parent::getCacheTags(), [
      "node:{$nid}",
    ]);
  }
  return parent::getCacheTags();
}