/** * {@inheritdoc} */ public function getCacheKeys() { // Add a key for the active book trail. $current_bid = 0; if ($node = $this->requestStack->getCurrentRequest()->get('node')) { $current_bid = empty($node->book['bid']) ? 0 : $node->book['bid']; } if ($current_bid === 0) { return parent::getCacheKeys(); } $active_trail = $this->bookManager->getActiveTrailIds($node->book['bid'], $node->book); $active_trail_key = 'trail.' . implode('|', $active_trail); return array_merge(parent::getCacheKeys(), array($active_trail_key)); }