/** * Adds breadcrumbs dynamically based on current module, submodule and action. * This might look a bit rough to the user. * Please prefer adding breadcrumbs manually via add(). */ public static function addDynamicBreadcrumbs() { $module = strtolower(TargetRoute::getModule()); $controller = strtolower(TargetRoute::getController()); $action = TargetRoute::getActionNameWithoutPrefix(); if (isset($module) and $module !== 'controlcenter') { $url = 'index.php?mod=' . $module; // Level 2 // do not add ctrl part, if controller and module are the same if ($controller !== '' and $controller !== $module) { $url .= '&ctrl=' . $controller; $module .= ' ' . $controller; } self::add($module, $url); // Level 3 if ($action !== '') { $url .= '&action=' . $action; self::add($action, $url); } } }
public function executeFilter(HttpRequestInterface $request, HttpResponseInterface $response) { $modulename = TargetRoute::getController(); $this->locale->loadTextDomain('LC_ALL', $modulename, $this->locale->getLocale(), $modulename); }
/** * Creates a cache_id. * * @return string Returns md5 string as cache_id. */ public static function createCacheId() { $module = TargetRoute::getModule(); $controller = TargetRoute::getController(); $action = TargetRoute::getMethod(); return md5(strtolower($module . $controller . $action)); }
/** * Return Theme Template Paths. * * @return string[] Theme Template Paths */ public static function getThemeTemplatePaths() { // get module, submodule, renderer names $module = TargetRoute::getModule(); $controller = TargetRoute::getController(); #$renderer = HttpRequest::getRoute()->getRenderEngine(); $theme_paths = []; /* * BACKEND THEME * when either "controlcenter" or "admin" is requested, it has to be a BACKEND theme. */ if ($module === 'controlcenter' or $controller === 'admin') { $theme = TargetRoute::getBackendTheme(); // (a) USER BACKENDTHEME - check in the active session backendtheme // e.g. /themes/backend/ + admin/template_name.tpl $theme_paths[] = APPLICATION_PATH . '/backend/' . $theme; // e.g. /themes/backend/ + admin/modules/template_name.tpl $theme_paths[] = APPLICATION_PATH . '/backend/' . $theme . '/modules/' . $module . DIRECTORY_SEPARATOR; // (b) BACKEND FALLBACK - check the fallback dir: themes/admin $theme_paths[] = APPLICATION_PATH . '/backend/default/'; } else { // FRONTEND THEME $theme = TargetRoute::getFrontendTheme(); // (a) USER FRONTENDTHEME - check, if template exists in current session user THEME $theme_paths[] = APPLICATION_PATH . '/frontend/' . $theme . DIRECTORY_SEPARATOR; // (b) FRONTEND FALLBACK - check, if template exists in usertheme/modulename/tpl $theme_paths[] = APPLICATION_PATH . '/frontend/' . $theme . '/modules/' . $module . DIRECTORY_SEPARATOR; // (c) FRONTEND FALLBACK - check, if template exists in standard theme $theme_paths[] = APPLICATION_PATH . '/frontend/default/'; } return $theme_paths; }