@param HasNodeInterface $page

@return \Kunstmaan\NodeBundle\Entity\Node|null
974844
public function getNodeFor(HasNodeInterface $page)
    {
        $translation = $this->getNodeTranslationFor($page);

        return $translation ? $translation->getNode() : null;
    }
1222056
protected function addPageToIndex(
        NodeTranslation $nodeTranslation,
        Node $node,
        NodeVersion $publicNodeVersion,
        HasNodeInterface $page
    ) {
        $rootNode = $this->currentTopNode;
        if (!$rootNode) {
            // Fetch main parent of current node...
            $rootNode = $this->em->getRepository('KunstmaanNodeBundle:Node')->getRootNodeFor(
                $node,
                $nodeTranslation->getLang()
            );
        }

        $doc = array(
            'root_id' => $rootNode->getId(),
            'node_id' => $node->getId(),
            'node_translation_id' => $nodeTranslation->getId(),
            'node_version_id' => $publicNodeVersion->getId(),
            'title' => $nodeTranslation->getTitle(),
            'slug' => $nodeTranslation->getFullSlug(),
            'page_class' => ClassLookup::getClass($page),
            'created' => $this->getUTCDateTime(
                $nodeTranslation->getCreated()
            )->format(\DateTime::ISO8601),
            'updated' => $this->getUTCDateTime(
                $nodeTranslation->getUpdated()
            )->format(\DateTime::ISO8601),
        );
        if ($this->logger) {
            $this->logger->info('Indexing document : ' . implode(', ', $doc));
        }

        // Permissions
        $this->addPermissions($node, $doc);

        // Search type
        $this->addSearchType($page, $doc);

        // Parent and Ancestors
        $this->addParentAndAncestors($node, $doc);

        // Content
        $this->addPageContent($nodeTranslation, $page, $doc);

        // Add document to index
        $uid = 'nodetranslation_' . $nodeTranslation->getId();

        $this->addCustomData($page, $doc);

        $this->documents[] = $this->searchProvider->createDocument(
            $uid,
            $doc,
            $this->indexName . '_' . $nodeTranslation->getLang(),
            $this->indexType
        );
    }
1259002
public function render($template, PageInterface $page = null)
    {
        if (!$template) {
            return null;
        }

        $twigTemplate = $this->twig->createTemplate($template);

        return $twigTemplate->render([
            'node' => $page,
        ]);
    }
574834
protected function getCurrentRevision($page)
    {
        if (empty($page)) {
            return null;
        }
        $revision = $page->getCurrentRevision();
        if ($revision instanceof \Rcm\Entity\Revision) {
            return $revision->getRevisionId();
        }

        return null;
    }
1275742
public function paginate($perPage = null, $page = 1)
    {
        $this->paginated(true);

        $this->perPage = $perPage ?: $this->perPage;
        $this->page    = $page;

        return $this;
    }
508352
public function addPage($page = null)
    {
        if ($page = parent::addPage($page)) {
            $page->setParent($this);
        }

        return $page;
    }
803886
public function setPage(\Core\Entity\MenuPage $page = null) {
        $this->page = $page;

        return $this;
    }
1295615
protected function _hasPage($model, $page)
    {
        $params = $this->params($model);

        return !empty($params) && $params[$page . 'Page'];
    }
684599
public function makePageSnapshot(PageInterface $page)
    {
        foreach ($page->getLayoutBlock() as $layoutBlock) {
            $layoutBlockContent = $this->registry->getManagerForClass($layoutBlock->getClassType())->getRepository($layoutBlock->getClassType())->find(
                $layoutBlock->getObjectId()
            );
            $layoutBlock->takeSnapshot($this->serializer->serialize($layoutBlockContent, 'json'));
        }

        $pageSnapshotClass = $this->pageSnapshotManager->getClassName();

        /** @var \Networking\InitCmsBundle\Model\PageSnapshotInterface $pageSnapshot */
        $pageSnapshot = new $pageSnapshotClass($page);
        $pageSnapshot->setVersionedData($this->serializer->serialize($page, 'json'))
            ->setPage($page);

        if ($oldPageSnapshot = $page->getSnapshot()) {
            $snapshotContentRoute = $oldPageSnapshot->getContentRoute();
        } else {
            $contentRouteClass = $this->contentRouteManager->getClassName();
            /** @var \Networking\InitCmsBundle\Model\ContentRouteInterface $snapshotContentRoute */
            $snapshotContentRoute = new $contentRouteClass();
        }

        $pageSnapshot->setContentRoute($snapshotContentRoute);
        $pageSnapshot->setPath(self::getPageRoutePath($page->getPath()));

        $om = $this->registry->getManagerForClass($pageSnapshotClass);
        $om->persist($pageSnapshot);
        $om->flush();

        $snapshotContentRoute->setPath(self::getPageRoutePath($page->getPath()));
        $snapshotContentRoute->setObjectId($pageSnapshot->getId());

        if ($oldPageSnapshot && ($oldPageSnapshot->getPath() != self::getPageRoutePath($page->getPath()))) {
            $this->phpCache->clean();
        }

        $om = $this->registry->getManagerForClass(get_class($snapshotContentRoute));
        $om->persist($snapshotContentRoute);
        $om->flush();
    }
994038
public function getIndexablePageParts(HasPagePartsInterface $page, $context = 'main')
    {
        $contexts = array_unique(array_merge($this->contexts, [$context]));

        $indexablePageParts = [];
        foreach ($contexts as $context) {
            $pageParts = $this->em
                ->getRepository('KunstmaanPagePartBundle:PagePartRef')
                ->getPageParts($page, $context);

            foreach ($pageParts as $pagePart) {
                if ($pagePart instanceof IndexableInterface && !$pagePart->isIndexable()) {
                    continue;
                }
                $indexablePageParts[] = $pagePart;
            }
        }

        return $indexablePageParts;
    }
818944
public function deletePage(Page $page)
    {
        if ($page->hasMainSection()) {
            $this->getEntityManager()
                    ->getRepository('BackBee\NestedNode\Section')
                    ->deleteSection($page->getSection());
        }

        if (null !== $page->getContentSet()) {
            $this->getEntityManager()
                    ->createQueryBuilder()
                    ->update('BackBee\NestedNode\\Page', 'p')
                    ->set('p._contentset', ':null')
                    ->where('p._contentset = :uid')
                    ->setParameter('uid', $page->getContentSet()->getUid())
                    ->setParameter('null', null)
                    ->getQuery()
                    ->execute();

            $this->getEntityManager()
                    ->getRepository('BackBee\ClassContent\AbstractClassContent')
                    ->deleteContent($page->getContentSet());
        }

        $this->getEntityManager()
                ->createQueryBuilder()
                ->update('BackBee\ClassContent\AbstractClassContent', 'c')
                ->set('c._mainnode', ':null')
                ->where('c._mainnode = :uid')
                ->setParameter('uid', $page->getUid())
                ->setParameter('null', null)
                ->getQuery()
                ->execute();

        $this->getEntityManager()->remove($page);
    }
462476
public function andParentIs(Page $page = null)
    {
        if (null === $page) {
            // Looking for root
            return $this->andWhere($this->getSectionAlias() . '._parent IS NULL')
                            ->andWhere($this->getSectionAlias() . ' = ' . $this->getAlias());
        }

        if (false === $page->hasMainSection()) {
            // Page is leaf, no child
            return $this->andWhere('1 = 0');
        }

        $suffix = $this->getSuffix();
        $qOr = $this->expr()->orX();
        $qOr->add($this->getSectionAlias().'._parent = :parent'.$suffix)
                ->add($this->getAlias().'._section = :parent'.$suffix);

        return $this->andWhere($qOr)
                        ->andWhere($this->getAlias().'._level = :level'.$suffix)
                        ->setParameter('parent'.$suffix, $page->getSection())
                        ->setParameter('level'.$suffix, $page->getLevel() + 1);
    }
1176144
public function getRedirect(Request $request, PageInterface $page)
    {
        if (method_exists($page, 'getAlias') && $page instanceof PageInterface) {
            if ($alias = $page->getAlias()) {
                $alias->getFullPath();
                $baseUrl = $request->getBaseUrl();

                $route = ContentRouteManager::generateRoute($alias->getContentRoute(), $alias->getFullPath(), '');

                return new RedirectResponse($baseUrl.$route->getPath());
            }
        }

        return false;
    }
1068080
private function createMenus(PageInterface $page, array $menus)
    {
        if (!empty($menus)) {
            foreach ($menus as $parentName => $config) {
                if (null === $parent = $this->menuRepository->findOneByName($parentName)) {
                    $this->output->writeln(sprintf(
                        '<error>Parent menu "%s" not found for route "%s".</error>',
                        $parentName,
                        $page->getRoute()
                    ));

                    return false;
                }

                $name = $page->getRoute();
                if (null === $this->menuRepository->findOneBy(['name' => $name, 'parent' => $parent])) {
                    /** @var \Ekyna\Bundle\CmsBundle\Model\MenuInterface $menu */
                    $menu = $this->menuRepository->createNew();
                    $menu
                        ->setParent($parent)
                        ->setName($name)
                        ->setRoute($name);

                    if (isset($config['options'])) {
                        $menu->setOptions((array)$config['options']);
                    }
                    if (isset($config['attributes'])) {
                        $menu->setAttributes((array)$config['attributes']);
                    }

                    foreach ($this->locales as $locale) {
                        $menuTranslation = $menu->translate($locale, true);
                        $menuTranslation
                            ->setTitle($page->translate($locale)->getTitle());
                    }

                    if (!$this->validate($menu)) {
                        return false;
                    }

                    $this->menuOperator->persist($menu);
                }
            }
        }

        return true;
    }
915254
public function getPage($intPage = 1)
    {
        $intPage--; // Convert page no. to index no.
        if ($intPage < 0) {
            $intPage = 0;
        }

        $this->__elements->seek($intPage);

        $objReturn = $this->__elements->current();
        if ($objReturn === false || get_class($objReturn) !== "ValidFormBuilder\\Page") {
            $objReturn = null;
        }

        return $objReturn;
    }
801929
public static function page($page = null)
    {
        if ($page !== null) {
            self::$_page = $page;
        }
        return self::$_page;
    }
853851
public function addPage(NavigationPageInterface &$page, $priority = 1)
    {
        intval($priority);

        $permissions = $page->getPermissions();
        if (! empty($permissions) and Gate::denies('navigation-page-view', $page)) {
            return $this;
        }

        if (isset($page->priority)) {
            $priority = (int) $page->priority;
        }

        if ($page instanceof static) {
            $this->addSection($page);
        } else {
            while (isset($this->pages[$priority])) {
                $priority++;
            }

            $this->pages[$priority] = $page;
            $page->setRootSection($this);
        }

        return $this->update()->sort();
    }