prepare submodule to interact with route
This commit is contained in:
parent
07cd1d1272
commit
2f6cb764a4
@ -45,7 +45,7 @@ class Articles extends Controller {
|
|||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav_set_selected(t('Articles'));
|
nav_set_selected('Articles');
|
||||||
|
|
||||||
head_add_link([
|
head_add_link([
|
||||||
'rel' => 'alternate',
|
'rel' => 'alternate',
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Zotlabs\Web;
|
namespace Zotlabs\Web;
|
||||||
|
|
||||||
|
use Zotlabs\Extend\Route;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
@ -31,9 +33,23 @@ class SubModule {
|
|||||||
|
|
||||||
$filename = 'Zotlabs/Module/' . ucfirst(argv(0)) . '/'. ucfirst(argv($whicharg)) . '.php';
|
$filename = 'Zotlabs/Module/' . ucfirst(argv(0)) . '/'. ucfirst(argv($whicharg)) . '.php';
|
||||||
$modname = '\\Zotlabs\\Module\\' . ucfirst(argv(0)) . '\\' . ucfirst(argv($whicharg));
|
$modname = '\\Zotlabs\\Module\\' . ucfirst(argv(0)) . '\\' . ucfirst(argv($whicharg));
|
||||||
|
|
||||||
if(file_exists($filename)) {
|
if(file_exists($filename)) {
|
||||||
$this->controller = new $modname();
|
$this->controller = new $modname();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$routes = Route::get();
|
||||||
|
|
||||||
|
if($routes) {
|
||||||
|
foreach($routes as $route) {
|
||||||
|
if(is_array($route) && strtolower($route[1]) === strtolower(argv(0)) . '/' . strtolower(argv($whicharg))) {
|
||||||
|
include_once($route[0]);
|
||||||
|
if(class_exists($modname)) {
|
||||||
|
$this->controller = new $modname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,6 +59,7 @@ class SubModule {
|
|||||||
* @return boolean|mixed
|
* @return boolean|mixed
|
||||||
*/
|
*/
|
||||||
function call($method) {
|
function call($method) {
|
||||||
|
|
||||||
if(! $this->controller)
|
if(! $this->controller)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user