Merge remote-tracking branch 'origin/dev'
This commit is contained in:
commit
7187963ac9
8 changed files with 66 additions and 15 deletions
|
|
@ -177,7 +177,7 @@ class Controller_Component
|
|||
public function setParameters(/*.View_Composite.*/$view)
|
||||
{
|
||||
$form = new Form_Form();
|
||||
$options = new OptionFactory($this->db);
|
||||
$options = new OptionFactory($this->db, $this->registry);
|
||||
|
||||
$settings = $this->getInfo();
|
||||
$form->addFieldList($settings['parameter'], $options);
|
||||
|
|
@ -262,10 +262,16 @@ class Controller_Component
|
|||
$component->parameter = $params;
|
||||
$component->template = $params->get('template', false);
|
||||
|
||||
global $componentsConfig;
|
||||
$editor = $component->getEditUrl();
|
||||
if ($editor) {
|
||||
$componentsConfig[] = $editor;
|
||||
if(class_exists("Controller_Site")){ //Если мы в CMS2
|
||||
$instance = Controller_Site::getInstance();
|
||||
$instance->componentsConfig[] = $editor;
|
||||
}else{
|
||||
global $componentsConfig;
|
||||
$componentsConfig[] = $editor;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $component;
|
||||
|
|
@ -310,6 +316,10 @@ class Controller_Component
|
|||
return '?' . http_build_query($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated В CMS2 перенесено в контроллер сайта!
|
||||
*/
|
||||
|
||||
function addRequireJsPath($name, $path, $shim = null) {
|
||||
Controller_Site::addRequireJsPath($name, $path, $shim);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,6 +101,15 @@ class Controller_Front extends Controller_Action
|
|||
} else {
|
||||
$controller = false;
|
||||
}
|
||||
return $this->loadModule($name[0], $request, $controller);
|
||||
try{
|
||||
return $this->loadModule($name[0], $request, $controller);
|
||||
} catch (UserMessageException $ex) { //Исключение с понятным пользователю сообщением
|
||||
$mode = $request->get('mode');
|
||||
if($mode == 'ajax' || $mode == 'json'){
|
||||
return json_encode(['result'=>'fail', 'message'=> $ex->userMessage]);
|
||||
} else {
|
||||
return $ex->userMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue