You are here

public function SimpleBlockBlock::getCacheTags in Simple Block 8

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/SimpleBlockBlock.php, line 119

Class

SimpleBlockBlock
Defines a generic custom block config type.

Namespace

Drupal\simple_block\Plugin\Block

Code

public function getCacheTags() {
  $cache_tags = parent::getCacheTags();

  /** @var \Drupal\simple_block\Entity\SimpleBlock $simple_block */
  if ($simple_block = SimpleBlock::load($this
    ->getDerivativeId())) {
    $cache_tags = Cache::mergeTags($cache_tags, $simple_block
      ->getCacheTags());
    if (!empty($format_id = $simple_block
      ->getContent()['format'])) {
      if ($format = FilterFormat::load($format_id)) {
        $cache_tags = Cache::mergeTags($cache_tags, $format
          ->getCacheTags());
      }
    }
  }
  return $cache_tags;
}