Bugfix where sections does not load correct viewdir and modeldir.
This commit is contained in:
parent
9b3bf5fc20
commit
71547eec26
@ -56,7 +56,8 @@ class Sections extends Module {
|
|||||||
public function layoutLoadEvent($event) {
|
public function layoutLoadEvent($event) {
|
||||||
$layout_name = $event->layout;
|
$layout_name = $event->layout;
|
||||||
if ($this->currentSection !== null) {
|
if ($this->currentSection !== null) {
|
||||||
$event->directory = $this->view_path;
|
$section = $this->getSection($this->currentSection);
|
||||||
|
$event->directory = $section['view_path'];
|
||||||
}
|
}
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
@ -70,7 +71,8 @@ class Sections extends Module {
|
|||||||
public function modelLoadEvent($event) {
|
public function modelLoadEvent($event) {
|
||||||
$model_name = $event->model;
|
$model_name = $event->model;
|
||||||
if ($this->currentSection !== null) {
|
if ($this->currentSection !== null) {
|
||||||
$event->directory = $this->model_path;
|
$section = $this->getSection($this->currentSection);
|
||||||
|
$event->directory = $section['model_path'];
|
||||||
}
|
}
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
@ -86,14 +88,28 @@ class Sections extends Module {
|
|||||||
* @param String View_path, where to find the views for this section
|
* @param String View_path, where to find the views for this section
|
||||||
*/
|
*/
|
||||||
public function addSection($name, $module_section = false, $module_name = null, $controller_path = null, $model_path = null, $view_path = null) {
|
public function addSection($name, $module_section = false, $module_name = null, $controller_path = null, $model_path = null, $view_path = null) {
|
||||||
$data = array(
|
if ($module_section) {
|
||||||
'name' => $name,
|
$m = $this->core->loadMod($module_name);
|
||||||
'module_section' => $module_section,
|
$m_dir = $m->getModulePath();
|
||||||
'module_name' => $module_name,
|
$data = array(
|
||||||
'controller_path' => FUZEPATH . $controller_path,
|
'name' => $name,
|
||||||
'model_path' => FUZEPATH . $model_path,
|
'module_section' => $module_section,
|
||||||
'view_path' => FUZEPATH . $view_path,
|
'module_name' => $module_name,
|
||||||
);
|
'controller_path' => $m_dir . '/Controller/',
|
||||||
|
'model_path' => $m_dir . '/Models/',
|
||||||
|
'view_path' => $m_dir . '/Views/',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$data = array(
|
||||||
|
'name' => $name,
|
||||||
|
'module_section' => $module_section,
|
||||||
|
'module_name' => $module_name,
|
||||||
|
'controller_path' => FUZEPATH . $controller_path,
|
||||||
|
'model_path' => FUZEPATH . $model_path,
|
||||||
|
'view_path' => FUZEPATH . $view_path,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->config->set('sections', $name, $data, $this->getModulePath());
|
$this->config->set('sections', $name, $data, $this->getModulePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +170,18 @@ class Sections extends Module {
|
|||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a section file
|
||||||
|
* @access public
|
||||||
|
* @param String section name
|
||||||
|
* @return Array Section
|
||||||
|
*/
|
||||||
|
public function getSection($name) {
|
||||||
|
if (isset($this->cfg->$name)) {
|
||||||
|
return $this->cfg->$name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves section information from the config file
|
* Retrieves section information from the config file
|
||||||
* @access public
|
* @access public
|
||||||
|
Loading…
Reference in New Issue
Block a user