PHP Класс luya\base\Module

Автор: Basil Suter ([email protected])
Наследование: extends yii\base\Module
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
registerTranslations ( ) register the translation service for luya

Описание методов

getControllerFiles() публичный Метод

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.
С версии: 1.0.0-beta5
public getControllerFiles ( ) : array
Результат array Returns an array where the key is the controller id and value the original file.

getLayoutPath() публичный Метод

the *@app* namespace views will be looked up for view files
См. также: yii\base\Module::getLayoutPath()
public getLayoutPath ( ) : string
Результат string

getNamespace() публичный Метод

returns "luya\base" for example.
public getNamespace ( ) : string
Результат string

import() публичный Метод

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.
Результат boolean | array

init() публичный Метод

public init ( )

registerComponents() публичный Метод

register a component to the application. id => definition. All components will be registered during bootstrap process.
public registerComponents ( ) : array
Результат array

resolveRoute() публичный Метод

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`
Результат string

Описание свойств

$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' ]
public $apis

$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".
public $context

$moduleLayout публичное свойство

The default name of the moduleLayout
public $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.
public $requiredComponents

$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.
public $tags

$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');
С версии: 1.0.0-beta3
public $translations

$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.
public $urlRules

$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.
public $useAppLayoutPath

$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 $useAppViewPath