public function renderView() { $scriptFilename = $this->inflectViewScriptName(); if (!file_exists($this->viewScriptPath . '/' . $scriptFilename)) { if ($this->stockSubclassHasViewScript($scriptFilename)) { $this->view->setScriptPath($this->getClassLocation() . '/view-scripts'); } else { $this->view->setScriptPath(__DIR__ . '/view-scripts'); } } return parent::renderView(); }
/** * Set the redirect URL to a page in the current component. * * The page parameter should be supplied with capitalization matching * the file and class name (e.g. "Index", not "index"). * * @param string $page * @param array $params * @return \Dewdrop\Admin\ResponseHelper\Standard */ public function redirectToAdminPage($page, array $params = array()) { $this->redirectUrl = $this->page->url($page, $params); return $this; }
/** * Run any page dispatch callbacks assigned to the provided page. We support * both the WP and hyphen-separated versions of the page names in this method * to make it easier to reuse page dispatch code across different environments. * * @param PageAbstract $page * @return $this */ private function executePageDispatchCallbacks(PageAbstract $page) { /* @var $inflector Inflector */ $inflector = $this->hasPimpleResource('inflector') ? $this->getPimpleResource('inflector') : new Inflector(); $names = [$page->getName(), $inflector->hyphenize($page->getName())]; foreach ($names as $name) { if (array_key_exists($name, $this->pageDispatchCallbacks)) { foreach ($this->pageDispatchCallbacks[$name] as $callback) { call_user_func($callback, $page); } break; } } return $this; }
/** * Override the PageAbstract contructor so we can add a \Dewdrop\Fields\Edit * object before proceeding to init(). * * @param ComponentAbstract $component * @param Request $request * @param string $pageFile The file in which the page class is defined. */ public function __construct(ComponentAbstract $component, Request $request, $pageFile) { parent::__construct($component, $request, $pageFile); $this->inputFilter = new InputFilter(); $this->fields = new EditFields($this->inputFilter); }