4.3 Base controllers

In Yii2AdminModule there are two controllers, which can be used by child application
controllers:

AdminController

When using this controller, a class AdminView will be loaded with its assets. This is done
using getView() method, which in turn is taken from module class with getting the
view component.

CommonAdminController

This controller extends AdminController.
There are already created universal basic methods for child application controllers:

actionIndex();

actionView($id);

actionCreate();

actionUpdate($id);

actionDelete($id);

In order for the child application controller to work with the CommonAdminController, it is
necessary to define the functions in child controller:

getModelName(); Sets the name of main model class.

getSearchModelName(); - Sets the name of main search model class.

In CommonAdminController there are the next interesting options:

viewCreated - to view the record after it's creation instead all record list.

additionFields - array of addition fields with heir values for the view template.

additionAttributes - array of addition attributes with their values for current
model, which can be set in model except for those that are sent from the form.
Example: information about the uploaded file, which was uploaded separate from the main send from the form.

4.4 Integrated controllers

In Yii2AdminModule there is one integrated controller:

LanguageController - to manage just languages for application data.

4.5 Multilanguage mode for dashboard tools

Multilanguage mode just for dashboard you can set by language parameter in app configuration: en-US, ru-RU e.t.c.

4.6 Multilanguage mode for data

There is an opportunity to set modes by application configuration, using parameter:

isMultilanguage - work in multilanguage mode just for content.

When true, the sidebar link "Languages" in main menu will appear automatically.

And application configuration will take an appearance:

use Itstructure\AdminModule\Module;
use Itstructure\AdminModule\components\AdminView;

This widget (when for example two languages ru and en) will parse the form fields so:

title_en

title_ru

description_en

description_ru

if do not set the attribute languageModel, form fields will not be multilanguage and
will be single.

$model - will be set automatically in CommonAdminController as object of
Itstructure\AdminModule\models\MultilanguageValidateModel, in which the main model can
be set after define her class name by method getModelName().

Configure the multilanguage component multilanguage-validate-component for admin module with rules for validation
multilanguage data in application config, like in example:

use Itstructure\AdminModule\Module;
use Itstructure\AdminModule\components\AdminView;
use Itstructure\AdminModule\components\MultilanguageValidateComponent;