i14a45 / yii2-custom-fields
Custom fields module for Yii 2
dev-master
2021-05-13 14:33 UTC
Requires
- php: >=7.3
- yii2tech/ar-position: *
- yiisoft/yii2: ~2.0.37
This package is auto-updated.
Last update: 2025-03-13 22:39:22 UTC
README
Installation
The preferred way to install this extension is through composer.
composer require i14a45/yii2-custom-fields
Configuration
Database Migrations
./yii migrate --migrationPath=@vendor/i14a45/yii2-custom-fields/migrations
Module setup
To access the module, you need to add the following code to your application configuration:
return [
//...
'modules' => [
//...
'custom-fields' => [
'class' => \i14a45\customfields\Module::class,
'models' => [
[
'class' => SampleModel::class,
'name' => 'Sample model',
],
],
],
],
];
>NOTE: Module id must be custom-fields
and not otherwise
Behavior
use i14a45\customfields\behaviors\CustomFieldsBehavior;
class SampleModel extends \yii\db\ActiveRecord {
public function behaviors()
{
return [
'customFields' => [
'class' => CustomFieldsBehavior::class,
]
];
}
}