/**
  * @return array
  */
 public function generateRouteList()
 {
     $routeList = array();
     $controllers = Metadata::getModuleControllers();
     // var_dump($controllers);
     foreach ($controllers as $controller) {
         $objController = Yii::$app->createController($controller['name'] . '/')[0];
         $actions = Metadata::getControllerActions($objController);
         foreach ($actions as $action) {
             $routeName = $objController->id . '/' . $action['name'];
             $routeList[$routeName] = $routeName;
         }
     }
     return $routeList;
 }
Exemple #2
0
 public function testModuleControllers()
 {
     $controllers = Metadata::getModuleControllers('user');
     $this->assertEquals('/user/admin', $controllers[0]['route']);
     $this->assertEquals('/en/user/admin', $controllers[0]['url']);
 }
Exemple #3
0
<?php

use rmrevin\yii\fontawesome\FA;
/*
 * @var yii\web\View $this
 */
$controllers = \dmstr\helpers\Metadata::getModuleControllers($this->context->module->id);
$favourites = [];
$patterns = ['^default$' => ['color' => 'gray', 'icon' => FA::_CUBE], '^.*$' => ['color' => 'blue', 'icon' => FA::_CUBE]];
foreach ($patterns as $pattern => $options) {
    foreach ($controllers as $c => $item) {
        $controllers[$c]['label'] = $item['name'];
        if (preg_match("/{$pattern}/", $item['name'])) {
            $favourites[$c] = $item;
            $favourites[$c]['head'] = $item['name'];
            $favourites[$c]['label'] = 'Controller';
            $favourites[$c]['color'] = $options['color'];
            $favourites[$c]['icon'] = isset($options['icon']) ? $options['icon'] : null;
            unset($controllers[$c]);
        }
    }
}
?>

<?php 
echo $this->render('@vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app/default/_controllers.php', ['controllers' => $controllers, 'favourites' => $favourites, 'modelNamespace' => 'app\\models\\']);
?>

<?php

namespace _;

use insolita\wgadminlte\Box;
use yii\data\ArrayDataProvider;
use yii\widgets\ListView;
/* @var $this \yii\web\View */
?>

<?php 
$this->beginBlock('routes');
?>

<?php 
$controllerDataProvider = new ArrayDataProvider(['allModels' => \dmstr\helpers\Metadata::getModuleControllers($key)]);
?>

<?php 
echo ListView::widget(['dataProvider' => $controllerDataProvider, 'layout' => "{items}\n{pager}", 'itemView' => '_controller']);
?>

<?php 
$this->endBlock();
?>


<?php 
Box::begin(['title' => $key . ' ' . (isset($model) && is_object($model) ? '<span class="label label-info">loaded</span>' : ''), 'collapse' => true, 'collapse_remember' => false]);
echo $this->blocks['routes'];
Box::end();