You are here

public function UpdateCacheSubscriber::onUpdateCache in Custom Contextual Links 8.2

Respond to the ccl_update_cache event.

File

src/EventSubscriber/UpdateCacheSubscriber.php, line 69

Class

UpdateCacheSubscriber
Class EventSubscriber.

Namespace

Drupal\ccl\EventSubscriber

Code

public function onUpdateCache() {
  $linkIds = $this->entityStorage
    ->getQuery()
    ->execute();

  /** @var \Drupal\ccl\Entity\CustomContextualLink[] $links */
  $links = $this->entityStorage
    ->loadMultiple($linkIds);
  $typeLinks = [];
  foreach ($links as $link) {
    if ($link
      ->getLinkType() == $this->linkType) {
      $typeLinks[] = $link;
    }
  }
  $this
    ->processLinks($typeLinks);
}