/** * Returns a page instance for the given name or false on failure * * @param string $name * @return \Dewdrop\Admin\Page\PageAbstract|false */ public function createPage($name) { // Remain compatible with WP style naming $name = $this->component->getInflector()->hyphenize($name); if (array_key_exists($name, $this->pageClassMap)) { $pageClass = $this->pageClassMap[$name]; $reflectedClass = new ReflectionClass($pageClass); return new $pageClass($this->component, $this->component->getRequest(), dirname($reflectedClass->getFileName()) . '/view-scripts'); } return false; }
/** * Provide the component for which the pages will be created. * * @param ComponentAbstract $component */ public function __construct(ComponentAbstract $component) { $this->component = $component; $this->inflector = $component->getInflector(); }