public function __invoke(Page $page) { if (!$page->isIndex()) { $this->logger->info(" Skipping TOC entries for non-index {$page->getTarget()}"); return; } $this->logger->info(" Adding TOC entries for {$page->getTarget()}"); $this->tocEntries = array(); $this->addTocEntries($page); $page->setTocEntries($this->tocEntries); }
public function __invoke(Page $page) { if (!$page->isIndex()) { $this->logger->info(" Skipping TOC entries for non-index {$page->getTarget()}"); return; } $this->logger->info(" Adding TOC entries for {$page->getTarget()}"); $this->tocEntries = array(); // if there are multiple books, ensure correct toc level $this->addTocEntries($page, $page->getConfig()->getTocDepth(), $page->isRoot() ? 0 : 1); $page->setTocEntries($this->tocEntries); }