luya\console\commands\ModuleController::renderFrontend PHP Method

renderFrontend() public method

Render the frontend template.
public renderFrontend ( array $folders, string $name, string $ns ) : string
$folders array
$name string
$ns string
return string
    public function renderFrontend($folders, $name, $ns)
    {
        return $this->view->render('@luya/console/commands/views/module/frontendmodule.php', ['folders' => $folders, 'name' => $this->humanizeName($name), 'ns' => $ns, 'luyaText' => $this->getGeneratorText('module/create')]);
    }

Usage Example

Example #1
0
    public function testRenderFrontend()
    {
        $ctrl = new ModuleController('module', Yii::$app);
        $content = $ctrl->renderFrontend([], 'foo', 'app\\modules');
        $tpl = <<<'EOT'
<?php

namespace app\modules\frontend;

/**
 * Foo Admin Module.
 *
 * File has been created with `module/create` command on LUYA version 1.0.0-dev. 
 */
class Module extends \luya\base\Module
{

}
EOT;
        $this->assertSame($tpl, $content);
    }