PHP Class luya\base\Module

Author: Basil Suter ([email protected])
Inheritance: extends yii\base\Module
Mostra file Open project: luyadev/luya Class Usage Examples

Public Properties

Property Type Description
$apis Contains the apis for each module to provided them in the admin module. They represents the name of the api and the value represents the class. Example value: php [ 'api-admin-user' => 'admin\apis\UserController', 'api-cms-navcontainer' => 'admin\apis\NavContainerController' ]
$context if this/the module is included via another module (parent module), the parent module will write its name inside the child modules $context variable. For example the cms includes the news module, the context variable of news would have the value "cms".
$moduleLayout The default name of the moduleLayout
$requiredComponents An array containing all components which should be registered for the current module. If the component does not exists an Exception will be thrown.
$tags An array with Tag class names to inject into the tag parser on luya boot, where key is the identifier and value the create object conifg: php [ 'link' => 'luya\cms\tags\LinkTag', 'file' => ['class' => 'luya\admin\tags\FileTag'], ] As by default the yii2 configurable object you can also pass properties to your tag object in order to configure them.
$translations Add translations for your module, all translation array must have the keys "prefix", "basePath" and "fileMap" For example: php $this->translations = [ ['prefix' => 'luya*', 'basePath' => '@luya/messages', 'fileMap' => ['luya/admin' => 'admin.php']], ], To use this translation run or createa a static helper method in your module.php php Yii::t('luya/admin', 'MyVariableInAdminPhp');
$urlRules Contains all urlRules for this module. Can't provided in key value pairing for pattern<=>route must be array containing class name or array with pattern, route informations.
$useAppLayoutPath Defines the location of the layout file whether in the @app namespace or a module: - true = looking for layout file in @app/views//layouts. - false = looking for layout file in @module/views/layouts/. This variable is only available if your not in a context call. A context call would be if the cms renders the module.
$useAppViewPath Define the location of the view files inside the controller actions - true = the view path of the @app/views - false = the view path of the @modulename/views

Public Methods

Method Description
getControllerFiles ( ) : array Returns all controller files of this module from the getControllerPath() folder, where the key is the reusable id of this controller and value the file on the server.
getLayoutPath ( ) : string Override the default implementation of Yii's getLayoutPath(). If the property $useAppLayoutPath is true,.
getNamespace ( ) : string returns "luya\base" for example.
import ( luya\console\interfaces\ImportControllerInterface $importer ) : boolean | array Define a last of importer class with an array or run code directily with the import() method.
init ( )
registerComponents ( ) : array register a component to the application. id => definition. All components will be registered during bootstrap process.
resolveRoute ( string $route ) : string Extract the current module from the route and return the new resolved route.

Private Methods

Method Description
registerTranslations ( ) register the translation service for luya

Method Details

getControllerFiles() public method

Returns all controller files of this module from the getControllerPath() folder, where the key is the reusable id of this controller and value the file on the server.
Since: 1.0.0-beta5
public getControllerFiles ( ) : array
return array Returns an array where the key is the controller id and value the original file.

getLayoutPath() public method

the *@app* namespace views will be looked up for view files
See also: yii\base\Module::getLayoutPath()
public getLayoutPath ( ) : string
return string

getNamespace() public method

returns "luya\base" for example.
public getNamespace ( ) : string
return string

import() public method

Define a last of importer class with an array or run code directily with the import() method.
public import ( luya\console\interfaces\ImportControllerInterface $importer ) : boolean | array
$importer luya\console\interfaces\ImportControllerInterface The importer controller class which will be invoke to the import method.
return boolean | array

init() public method

public init ( )

registerComponents() public method

register a component to the application. id => definition. All components will be registered during bootstrap process.
public registerComponents ( ) : array
return array

resolveRoute() public method

Extract the current module from the route and return the new resolved route.
public resolveRoute ( string $route ) : string
$route string Route to resolve, e.g. `admin/default/index`
return string

Property Details

$apis public_oe property

Contains the apis for each module to provided them in the admin module. They represents the name of the api and the value represents the class. Example value: php [ 'api-admin-user' => 'admin\apis\UserController', 'api-cms-navcontainer' => 'admin\apis\NavContainerController' ]
public $apis

$context public_oe property

if this/the module is included via another module (parent module), the parent module will write its name inside the child modules $context variable. For example the cms includes the news module, the context variable of news would have the value "cms".
public $context

$moduleLayout public_oe property

The default name of the moduleLayout
public $moduleLayout

$requiredComponents public_oe property

An array containing all components which should be registered for the current module. If the component does not exists an Exception will be thrown.
public $requiredComponents

$tags public_oe property

An array with Tag class names to inject into the tag parser on luya boot, where key is the identifier and value the create object conifg: php [ 'link' => 'luya\cms\tags\LinkTag', 'file' => ['class' => 'luya\admin\tags\FileTag'], ] As by default the yii2 configurable object you can also pass properties to your tag object in order to configure them.
public $tags

$translations public_oe property

Add translations for your module, all translation array must have the keys "prefix", "basePath" and "fileMap" For example: php $this->translations = [ ['prefix' => 'luya*', 'basePath' => '@luya/messages', 'fileMap' => ['luya/admin' => 'admin.php']], ], To use this translation run or createa a static helper method in your module.php php Yii::t('luya/admin', 'MyVariableInAdminPhp');
Since: 1.0.0-beta3
public $translations

$urlRules public_oe property

Contains all urlRules for this module. Can't provided in key value pairing for pattern<=>route must be array containing class name or array with pattern, route informations.
public $urlRules

$useAppLayoutPath public_oe property

Defines the location of the layout file whether in the @app namespace or a module: - true = looking for layout file in @app/views//layouts. - false = looking for layout file in @module/views/layouts/. This variable is only available if your not in a context call. A context call would be if the cms renders the module.
public $useAppLayoutPath

$useAppViewPath public_oe property

Define the location of the view files inside the controller actions - true = the view path of the @app/views - false = the view path of the @modulename/views
public $useAppViewPath