skeeks/yii2-config

Form package for SkeekS CMS

Installs: 971

Dependents: 2

Suggesters: 0

Stars: 0

Watchers: 1

Forks: 0

Type:yii2-extension

0.1.0 2018-05-21 18:34 UTC

README

Links



namespace skeeks\cms\widgets;

use skeeks\yii2\config\ConfigBehavior;
use skeeks\yii2\config\ConfigTrait;
use yii\base\Widget;
use yii\helpers\ArrayHelper;

/**
 * Class GridView
 * @package skeeks\cms
 */
class TestWidget extends Widget
{
    use ConfigTrait;

    public $test = '22';

    public $config = [];

    public function behaviors()
    {
        return ArrayHelper::merge(parent::behaviors(), [

            ConfigBehavior::class => ArrayHelper::merge([
                'class' => ConfigBehavior::class,
                'configModel' => [
                    'fields' => [
                        'test'
                    ],
                    'attributeDefines' => [
                        'test',
                    ],
                    'attributeLabels' => [
                        'test' => '111',
                    ],
                    'attributeHints' => [
                        'test' => '111',
                    ],
                    'rules' => [
                        ['test', 'string']
                    ]
                ]
            ], (array) $this->config),

        ]);
    }

    public function run()
    {
        return $this->test;
    }
}

skeeks!
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com