/** * @return FrontendModule */ protected function FrontendModule() { if (!$this->frontendModule) { $this->frontendModule = ClassFinder::CreateFrontendModule($this->Value('Module')); } return $this->frontendModule; }
/** * Initializes a new content branch * @param mixed $item The content tree item */ function __construct($item) { $this->item = $item; $this->tree = $this->TreeProvider(); $this->child = $this->tree->FirstChildOf($this->item); $this->content = $this->tree->ContentByItem($this->item); $this->module = ClassFinder::CreateFrontendModule($this->content->GetType()); $this->module->SetTreeItem($this->tree, $this->item); }
protected function Init() { $this->bundlesModules = ClassFinder::BackendNavModules(); $coreModules = $this->bundlesModules['Core']; //unset overview module unset($coreModules[0]); $this->bundlesModules['Core'] = array_values($coreModules); return parent::Init(); }
/** * Renders the content * @return string Returns the rendered content */ function Render() { if (!self::Guard()->Allow(Action::Read(), $this->content)) { return ''; } ContentTranslator::Singleton()->SetContent($this->content); $module = ClassFinder::CreateFrontendModule($this->content->GetType()); $module->SetTreeItem($this->tree, $this->item); return $module->Render(); }
/** * Initializes the bundle and module names * @param array $idParts */ private function InitModule(array $idParts) { if (count($idParts) < 1 || count($idParts) > 2) { //TODO: Message Response::Redirect(BackendRouter::ModuleUrl(new TemplateList())); } $this->module = ClassFinder::CreateFrontendModule($idParts[0]); if (!$this->module instanceof FrontendModule || !$this->module->AllowCustomTemplates()) { //TODO: Message Response::Redirect(BackendRouter::ModuleUrl(new TemplateList())); } }
/** * Loads installed bundles to the frontend * @param Site $site */ static function LoadInstalledToFrontend(Site $site) { $bundles = InstalledBundle::Schema()->Fetch(); foreach ($bundles as $bundle) { $manifest = ClassFinder::Manifest($bundle->GetBundle()); $manifest->LoadToFrontend($site); } }
/** * The removel template module * @param array $idParts * @return FrontendModule */ protected function RemovalTemplateModule(array $idParts) { if (count($idParts) != 2) { return null; } $module = ClassFinder::CreateFrontendModule($idParts[0]); return $module instanceof FrontendModule && $module->AllowCustomTemplates() ? $module : null; }
/** * Gets all backend module names for a bundle * @param string $bundle The bundle name * @return string Returns the module names */ protected function Modules($bundle) { $modules = PathUtil::BackendModules($bundle); $result = array(); foreach ($modules as $module) { $instance = ClassFinder::CreateBackendModule(ClassFinder::CalcModuleType($bundle, $module)); if ($instance instanceof BackendModule) { $result[] = $module; } } return $result; }
/** * Initializes the side navigation */ protected function Init() { $this->bundleModules = ClassFinder::BackendNavModules(); return parent::Init(); }
/** * Returns the module type, composed by bundle and module name * @return string Returns a simplified type string */ static function MyType() { return ClassFinder::ModuleType(new static()); }
/** * Installs a dependency * @param BundleDependency $dependency * @return boolean */ private function InstallDependency(BundleDependency $dependency) { $bundle = $dependency->BundleName(); if (array_key_exists($bundle, $this->failedBundles)) { return false; } $installedVersion = $this->InstalledVersion($bundle); $manifest = ClassFinder::Manifest($bundle); if (!$installedVersion || version_compare($installedVersion, $manifest->Version()) < 0) { if (!$this->InstallBundle($bundle)) { return false; } } return true; }
/** * Gets the module from request url * @return ModuleBase Returns the backend module */ static function UrlModule() { $module = Request::GetData('module'); return ClassFinder::CreateBackendModule($module); }