skeeks/yii2-config

Form package for SkeekS CMS

Installs: 2 287

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Type:yii2-extension

1.0.3 2022-07-24 09:05 UTC

This package is auto-updated.

Last update: 2024-11-26 18:32:16 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