phemellc / yii2-settings

Yii2 Settings Module
Other
151 stars 74 forks source link

Add value validation according type #40

Closed RSol closed 8 years ago

arisk commented 8 years ago

Thank you for your PR. This looks cool! Please give me some time to review it.

RSol commented 8 years ago

I prepare once more PR with

    public function actions()
    {
        return [
            'customer' => [
                'class' => SettingsAction::className(),
                'config' => [
                    'attributes' => [
                        [
                            'section' => 'currency',
                            'key' => 'rur',
                            'label' => 'RUB currency',
                        ],
                        [
                            'section' => 'currency',
                            'key' => 'usd',
                            'label' => 'USD currency',
                        ],
                        [
                            'section' => 'system',
                            'key' => 'email',
                            'label' => 'System E-mail',
                        ],
                    ],
                    'rules' => [
                        [['currency.rur', 'currency.usd', 'system.email'], 'required'],
                    ],
                ],
            ],
        ];
    }
arisk commented 8 years ago

Thank you!