public function setTemplate($action) { $replacements = array("@action" => ucfirst($action), "@variant" => "Default", "@package" => "Admin"); if (!empty($this->being)) { if (class_exists($this->being, false)) { $replacements["@package"] = $this->helper->getPackageByClassName($this->being) ? $this->helper->getPackageByClassName($this->being) : "Admin"; $replacements["@being"] = \Admin\Core\Helper::getShortName($this->being); $being = $this->helper->getBeing($this->being); $replacements["@variant"] = $being->variant->getVariant($action); } } if ($this->request->hasArgument("variant")) { $replacements["@variant"] = $this->request->getArgument("variant"); } $cache = $this->cacheManager->getCache('Admin_TemplateCache'); $identifier = str_replace(".", "_", implode("-", $replacements)); $noTemplate = false; if (!$cache->has($identifier)) { try { $template = $this->helper->getPathByPatternFallbacks("Views", $replacements); } catch (\Exception $e) { $noTemplate = true; } if (!$noTemplate) { $cache->set($identifier, $template); } } else { $template = $cache->get($identifier); } if (!$noTemplate) { $this->view->setTemplatePathAndFilename($template); if ($this->request->hasArgument("being")) { $meta["being"]["identifier"] = $this->request->getArgument("being"); $meta["being"]["name"] = $this->request->getArgument("being"); \Admin\Core\API::set("package", $replacements["@package"]); } } }
public function createBeing($being, $id = null) { $realAction = \Admin\Core\API::get("action"); \Admin\Core\API::set("action", "inline"); $b = $this->adapter->getBeing($this->being, $id); \Admin\Core\API::set("action", $realAction); $b->prefix = $this->getPrefix(); if (!empty($id)) { # $identity = array( $this->getPrefix() . "[__identity]" => $id ); $b->addHiddenProperty($this->getPrefix() . "[__identity]", $id); } return $b; }
public function getTemplate() { $realAction = \Admin\Core\API::get("action"); \Admin\Core\API::set("action", "inline"); $b = $this->adapter->getBeing($this->class); \Admin\Core\API::set("action", $realAction); $b->prefix = $this->parentProperty->getPrefix("{counter}"); return $b; }