public function init() { parent::init(); if (!$this->config()->service) { $this->httpError(404); } $this->setService($this->config()->service); $this->pageService = new StyleGuide\PageService($this); // redirect to the first action route if (!$this->request->param('Action')) { $page = $this->pageService->getPages()->first(); $this->redirect($page->Link); } // if no template set on the action route then redirect to the first child if (!$this->request->param('ChildAction') && !$this->pageService->getTemplate()) { $page = $this->pageService->getActivePage(); if (isset($page->Children)) { $childPage = $page->Children->first(); $this->redirect($childPage->Link); } } // set the service $this->setRequirements(); // load the fixture file $this->loadFixture(); }