目前,我正在加载 URL/Route 上的所有用户,这些用户正在从 Admin 模块/admin/config/users
中选择此视图 ( )。private/apps/Admin/Views/user/users.volt
现在我为自定义布局设置了一个标志。因此,如果启用了自定义布局,我希望 phalcon 从 AdminExtension 模块中选择视图,即(private/apps/Admin/Extension/Views/user/users.volt
)
我怎样才能做到这一点?我想要两种观点。因为private/apps/Admin/Views/user/users.volt
是列出所有用户的默认视图。然而private/apps/Admin/Extension/Views/user/users.volt
,是为客户定制的视图,其中完成了很多设计更改。
调度程序代码如下所示:
/**
* @param Dispatcher $dispatcher
*/
public function afterExecuteRoute(Dispatcher $dispatcher) {
// Check if Json response is required
if ($this->_isJsonResponse) {
//if body
} else {
if(CxSettingCustomLayout::loadFromDb()->isCustomLayout()) {
//pick custom view here" `private/apps/Admin/Extension/Views/user/users.volt`
}
// Build current module configuration settings section name
$moduleConfigName = 'app_' . $this->dispatcher->getModuleName();
// Include assets configuration file where assets collections are defined
if(file_exists($this->config[ $moduleConfigName ]['assetsFile']))
include $this->config[ $moduleConfigName ]['assetsFile'];
// Set a view variable with the current language code
$this->view->setVar('current_language_code', $this->CxTranslation->getLanguage()->getCode());
}
}