Example #1
0
 /**
  * @todo: see if $pathAfterRoute could be available in the urlRules, otherwise display default
  * (non-PHPdoc)
  *
  * @see cmsadmin\base.NavItemType::getContent()
  */
 public function getContent()
 {
     $module = $this->getModule();
     $reflection = \luya\helpers\ModuleHelper::reflectionObject($module);
     $reflection->suffix = $this->getOption('restString');
     return $reflection->run();
 }
Example #2
0
 private function moduleContent($moduleName)
 {
     if ($this->isAdminContext() || empty($moduleName) || count($this->getEnvOptions()) === 0) {
         return;
     }
     try {
         $ctrl = $this->getCfgValue('moduleController');
         $action = $this->getCfgValue('moduleAction', 'index');
         $actionArgs = json_decode($this->getCfgValue('moduleActionArgs'), true);
         if (empty($actionArgs)) {
             $actionArgs = [];
         }
         // get module
         $module = Yii::$app->getModule($moduleName);
         $module->context = 'cms';
         // start module reflection
         $reflection = ModuleHelper::reflectionObject($module);
         $reflection->suffix = $this->getEnvOption('restString');
         // if a controller has been defined we inject a custom starting route for the
         // module reflection object.
         if (!empty($ctrl)) {
             $reflection->defaultRoute($ctrl, $action, $actionArgs);
         }
         return $reflection->run();
     } catch (\Exception $err) {
         throw new Exception('Module Block Exception: ' . $err->getMessage());
     }
 }
Example #3
0
 private function moduleContent($moduleName)
 {
     if ($this->isAdminContext()) {
         return;
     }
     /*
      * in the admin context (means env options are empty) we do not have to render the module!
      */
     if (empty($moduleName) || count($this->getEnvOptions()) === 0) {
         return;
     }
     $ctrl = $this->getCfgValue('moduleController');
     $action = $this->getCfgValue('moduleAction');
     $actionArgs = json_decode($this->getCfgValue('moduleActionArgs'), true);
     if (empty($actionArgs)) {
         $actionArgs = [];
     }
     // get module
     $module = Yii::$app->getModule($moduleName);
     $module->context = 'cms';
     //$module->setContextOptions($this->getEnvOptions());
     // start module reflection
     $reflection = \luya\helpers\ModuleHelper::reflectionObject($module);
     $reflection->suffix = $this->getEnvOption('restString');
     if ($ctrl && $action) {
         $reflection->defaultRoute($ctrl, $action, $actionArgs);
     }
     return $reflection->run();
 }
Example #4
0
 /**
  * @todo: see if $pathAfterRoute could be available in the urlRules, otherwise display default
  * (non-PHPdoc)
  *
  * @see cmsadmin\base.NavItemType::getContent()
  */
 public function getContent()
 {
     $module = $this->getModule();
     $reflection = \luya\helpers\ModuleHelper::reflectionObject($module);
     $reflection->suffix = $this->getOption('restString');
     $response = $reflection->run();
     Yii::$app->menu->setCurrentUrlRule($reflection->getUrlRule());
     return $response;
 }