本文整理汇总了PHP中yii\base\Module::createController方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::createController方法的具体用法?PHP Module::createController怎么用?PHP Module::createController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Module
的用法示例。
在下文中一共展示了Module::createController方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createController
public function createController($route)
{
if ($this->beforeCreateController !== null && !call_user_func($this->beforeCreateController, $route)) {
return false;
}
return parent::createController($route);
}
示例2: createController
/**
* Override createController()
* @link https://github.com/yiisoft/yii2/issues/810
* @link http://www.yiiframework.com/forum/index.php/topic/21884-module-and-url-management/
*
* @param string $route
*
* @return array|bool
*/
public function createController($route)
{
preg_match('/(default)/', $route, $match);
if (isset($match[0])) {
return parent::createController($route);
}
return parent::createController("{$this->defaultRoute}/{$route}");
}
示例3: createController
public function createController($route)
{
if (strpos($route, 'admin/') !== false) {
return $this->getModule('admin')->createController(str_replace('admin/', '', $route));
} else {
return parent::createController($route);
}
}
示例4: createController
/**
* Override createController()
*
* @link https://github.com/yiisoft/yii2/issues/810
* @link http://www.yiiframework.com/forum/index.php/topic/21884-module-and-url-management/
*/
public function createController($route)
{
preg_match('/(default)/', $route, $match);
if (isset($match[0])) {
return parent::createController($route);
}
$this->defaultRoute = !$this->defaultRoute || $this->defaultRoute == 'default' ? 'url' : $this->defaultRoute;
if (sizeof(explode('/', $route)) > 1) {
list($this->defaultRoute, $route) = explode('/', $route);
}
return parent::createController("{$this->defaultRoute}/{$route}");
}
示例5: createController
public function createController($route)
{
// check valid routes
$validRoutes = [$this->defaultRoute, "admin", "album", "json"];
$isValidRoute = false;
foreach ($validRoutes as $validRoute) {
if (strpos($route, $validRoute) === 0) {
$isValidRoute = true;
break;
}
}
return (empty($route) or $isValidRoute) ? parent::createController($route) : parent::createController("{$this->defaultRoute}/{$route}");
}
示例6: createController
public function createController($route)
{
$this->normalizeController();
return parent::createController($route);
}
示例7: createController
/**
* Modify createController() to handle routes in the default controller
*
* This is a temporary hack until they add in url management via modules
* @link https://github.com/yiisoft/yii2/issues/810
* @link http://www.yiiframework.com/forum/index.php/topic/21884-module-and-url-management/
*
* "usr" and "usr/default" work like normal
* "usr/xxx" gets changed to "usr/default/xxx"
*
* @inheritdoc
*/
public function createController($route)
{
if (\Yii::$app instanceof \yii\console\Application) {
return parent::createController($route);
}
// check valid routes
$validRoutes = [$this->defaultRoute, 'auth', 'manager'];
$isValidRoute = false;
foreach ($validRoutes as $validRoute) {
if (strpos($route, $validRoute) === 0) {
$isValidRoute = true;
break;
}
}
if (!empty($route) && !$isValidRoute) {
$route = $this->defaultRoute . '/' . $route;
}
return parent::createController($route);
}
示例8: createController
public function createController($route)
{
return parent::createController($this->realRoute ? $this->realRoute : $route);
}
示例9: createController
public function createController($route)
{
return $this->beforeCreateController($route) ? parent::createController($route) : false;
}
示例10: createController
/**
* Modify createController() to handle routes in the default controller
*
* This is a temporary hack until they add in url management via modules
*
* @link https://github.com/yiisoft/yii2/issues/810
* @link http://www.yiiframework.com/forum/index.php/topic/21884-module-and-url-management/
*
* "user", "user/default", "user/admin", and "user/copy" work like normal
* any other "user/xxx" gets changed to "user/default/xxx"
*
* @inheritdoc
*/
public function createController($route)
{
// check valid routes
$validRoutes = [$this->defaultRoute, "admin", "copy", "auth", "abonnement", 'company', "user-activities"];
$isValidRoute = false;
foreach ($validRoutes as $validRoute) {
if (strpos($route, $validRoute) === 0) {
$isValidRoute = true;
break;
}
}
return (empty($route) or $isValidRoute) ? parent::createController($route) : parent::createController("{$this->defaultRoute}/{$route}");
}