Exemplo n.º 1
0
 public function rules()
 {
     $required = ['name', 'text'];
     if (Yii::$app->getModule('admin')->activeModules['feedback']->settings['enableEmail']) {
         $required[] = 'email';
     }
     return [[$required, 'required'], [['name', 'email', 'phone', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['title', 'string', 'max' => 128], ['email', 'email'], ['phone', 'match', 'pattern' => '/^[\\d\\s-\\+\\(\\)]+$/'], ['reCaptcha', ReCaptchaValidator::className(), 'when' => function ($model) {
         return $model->isNewRecord && Yii::$app->getModule('admin')->activeModules['feedback']->settings['enableCaptcha'];
     }]];
 }
Exemplo n.º 2
0
 public function rules()
 {
     return [[['name'], 'required', 'message' => Yii::t('easyii', 'Enter your name')], [['text'], 'required', 'message' => Yii::t('easyii', 'Enter your message ')], [['email'], 'required', 'message' => Yii::t('easyii', 'Enter Avalid Email')], [['phone'], 'required', 'message' => Yii::t('easyii', 'Enter your Phone')], ['email', 'email', 'message' => Yii::t('easyii', 'Enter Avalid Email')], [['name', 'email', 'phone', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['title', 'string', 'max' => 128], ['phone', 'number', 'message' => Yii::t('easyii', 'Phone should be number')], ['reCaptcha', ReCaptchaValidator::className(), 'when' => function ($model) {
         return $model->isNewRecord && Yii::$app->getModule('admin')->activeModules['awarness']->settings['enableCaptcha'];
     }]];
 }
Exemplo n.º 3
0
 public function rules()
 {
     return [[['name', 'text'], 'required'], [['name', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['email', 'email'], ['title', 'string', 'max' => 128], ['reCaptcha', ReCaptchaValidator::className(), 'on' => 'send', 'when' => function () {
         return Yii::$app->getModule('admin')->activeModules['guestbook']->settings['enableCaptcha'];
     }]];
 }
Exemplo n.º 4
0
 public function rules()
 {
     return [[['title'], 'required', 'message' => Yii::t('easyii', 'Enter Title')], [['name'], 'required', 'message' => Yii::t('easyii', 'Enter Company name')], [['text'], 'required', 'message' => Yii::t('easyii', 'Enter your message ')], [['email'], 'required', 'message' => Yii::t('easyii', 'Enter your Email')], [['phone'], 'required', 'message' => Yii::t('easyii', 'Enter your Phone')], [['name', 'email', 'phone', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['title', 'string', 'max' => 128], ['email', 'email', 'message' => Yii::t('easyii', 'Enter Avalid Email')], ['phone', 'match', 'pattern' => '/^[\\d\\s-\\+\\(\\)]+$/', 'message' => Yii::t('easyii', 'Enter Avalid phone number')], ['reCaptcha', ReCaptchaValidator::className(), 'when' => function ($model) {
         return $model->isNewRecord && Yii::$app->getModule('admin')->activeModules['agencies']->settings['enableCaptcha'];
     }]];
 }
Exemplo n.º 5
0
 public function rules()
 {
     return [[['name', 'text'], 'required'], [['name', 'email', 'phone', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['title', 'string', 'max' => 128], ['email', 'email'], ['reCaptcha', ReCaptchaValidator::className(), 'when' => function ($model) {
         return $model->isNewRecord && Yii::$app->getModule('admin')->activeModules['awarness']->settings['enableCaptcha'];
     }]];
 }