Commit c2457f95 by Luciano Baraglia

GII sub-modules support - see #871

parent bce3afcc
......@@ -197,7 +197,7 @@ class Generator extends \yii\gii\Generator
*/
public function getModule()
{
if (($pos = strpos($this->controller, '/')) !== false) {
if (($pos = strrpos($this->controller, '/')) !== false) {
$id = substr($this->controller, 0, $pos);
if (($module = Yii::$app->getModule($id)) !== null) {
return $module;
......
......@@ -87,18 +87,17 @@ class Generator extends \yii\gii\Generator
$output = <<<EOD
<p>The module has been generated successfully.</p>
<p>To access the module, you need to modify the application configuration as follows:</p>
<p>To access the module, you need to add this to your application configuration:</p>
EOD;
$code = <<<EOD
<?php
return array(
'modules'=>array(
......
'modules' => array(
'{$this->moduleID}' => array(
'class' => '{$this->moduleClass}',
),
),
......
);
EOD;
return $output . '<pre>' . highlight_string($code, true) . '</pre>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment