Source of file SitemapPageController.php
Size: 1,119 Bytes - Last Modified: 2021-12-24T06:43:14+00:00
/var/www/docs.ssmods.com/process/src/src/PageTypes/SitemapPageController.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | <?php namespace CWP\CWP\PageTypes; use PageController; use SilverStripe\CMS\Model\SiteTree; class SitemapPageController extends PageController { private static $allowed_actions = [ 'showpage', ]; private static $url_handlers = [ 'page/$ID' => 'showpage', ]; public function showpage($request) { $id = (int) $request->param('ID'); if (!$id) { return false; } $page = SiteTree::get()->byId($id); // does the page exist? if (!($page && $page->exists())) { return $this->httpError(404); } // can the page be viewed? if (!$page->canView()) { return $this->httpError(403); } $viewer = $this->customise([ 'IsAjax' => $request->isAjax(), 'SelectedPage' => $page, 'Children' => $page->Children(), ]); if ($request->isAjax()) { return $viewer->renderWith([ 'type' => 'Includes', 'SitemapNodeChildren' ]); } return $viewer; } } |