This extension provides controllers, actions, widgets and other tools for administration panel creation in Yii2 project.
For license information check the LICENSE-file.
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yii2tech/admin
or add
"yii2tech/admin": "*"
to the require section of your composer.json.
This extension provides controllers, actions, widgets and other tools for administration panel creation in Yii2 project. These tools are meant to be used together for the rapid web application administration panel composition.
This package supports usage of following extensions:
Note: none of these extensions is required by default, you'll need to install them yourself, if needed.
This extension provides several independent action classes, which provides particular operation support:
Please refer to the particular action class for more details.
For example CRUD controller based on provided actions may look like following:
namespace app\controllers;
use yii\web\Controller;
class ItemController extends Controller
{
public function actions()
{
return [
'index' => [
'class' => \yii2tech\admin\actions\Index::class,
'newSearchModel' => function () {
return new ItemSearch();
},
],
'view' => [
'class' => \yii2tech\admin\actions\View::class,
],
'create' => [
'class' => \yii2tech\admin\actions\Create::class,
],
'update' => [
'class' => \yii2tech\admin\actions\Update::class,
],
'delete' => [
'class' => \yii2tech\admin\actions\Delete::class,
],
];
}
public function findModel($id)
{
if (($model = Item::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
public function newModel()
{
return new Item();
}
}
This extension provides several predefined controllers, which can be used as a base controller classes while creating particular controllers:
Please refer to the particular controller class for more details.
This extension provides several widgets, which simplifies view composition for the typical use cases:
Also several enhancements for the [[\yii\grid\GridView]] are available:
This extension provides a code generators, which can be integrated with yii 'gii' module. In order to enable them, you should adjust your application configuration in following way:
return [
//....
'modules' => [
// ...
'gii' => [
'class' => yii\gii\Module::class,
'generators' => [
'adminMainFrame' => [
'class' => yii2tech\admin\gii\mainframe\Generator::class
],
'adminCrud' => [
'class' => yii2tech\admin\gii\crud\Generator::class
]
],
],
]
];
"MainFrame" generator creates a basic admin panel code, which includes layout files, main controller file and basic view files. The created structure is necessary for the correct rendering of the code created by "Admin CRUD" generator.
"Admin CRUD" generator is similar to regular "CRUD" generator, but it generates code, which uses tools from this extension, so the result code is much more clean.
All text and messages introduced in this extension are translatable under category 'yii2tech-admin'. You may use translations provided within this extension, using following application configuration:
return [
'components' => [
'i18n' => [
'translations' => [
'yii2tech-admin' => [
'class' => yii\i18n\PhpMessageSource::class,
'basePath' => '@yii2tech/admin/messages',
],
// ...
],
],
// ...
],
// ...
];
yii\base\Object::className()
in favor of native PHP syntax ::class
, which does not trigger autoloading (klimov-paul)yii2tech\admin\widgets\Alert
now determines alert type using wildcard match (klimov-paul)yii2tech\admin\widgets\ActionAlert
created (klimov-paul)yii2tech\admin\widgets\Alert
refactored allowing run()
method to return an output instead of using echo
(klimov-paul)
Comments