Example #1
0
 private function moduleContent($moduleName)
 {
     if ($this->isAdminContext()) {
         return null;
     }
     /**
      * 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 null;
     }
     $ctrl = $this->getCfgValue('moduleController');
     $action = $this->getCfgValue('moduleAction');
     $actionArgs = json_decode($this->getCfgValue('moduleActionArgs'), true);
     // get module
     $module = Yii::$app->getModule($moduleName);
     $module->setContext('cms');
     $module->setContextOptions($this->getEnvOptions());
     // start module reflection
     $reflection = new \luya\module\Reflection($module);
     $reflection->setModuleSuffix($this->getEnvOption('restString'));
     if ($ctrl && $action) {
         $reflection->setInitRun($ctrl, $action, $actionArgs);
     }
     $response = $reflection->responseContent();
     return $response;
 }
Example #2
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 = new \luya\module\Reflection($module);
     $reflection->setModuleSuffix($this->getOption('restString'));
     $response = $reflection->responseContent();
     return $response;
 }