if ($node instanceof NodeInterface && !
empty($node->book
['bid'
])) { $current_bid =
$node->book
['bid'
];
} // If we're not looking at a book node, then we're not navigating a book.
if ($current_bid === 0
) { return 'book.none';
} // If we're looking at a book node, get the trail for that node.
$active_trail =
$this->container->
get('book.manager'
) ->
getActiveTrailIds($node->book
['bid'
],
$node->book
);
return implode('|',
$active_trail);
} /**
* {@inheritdoc}
*/
public function getCacheableMetadata() { // The book active trail depends on the node and data attached to it.
// That information is however not stored as part of the node.
$cacheable_metadata =
new CacheableMetadata();
$node =
$this->routeMatch->
getParameter('node'
);