public function settingsValidate(Event $event, $data, Validator $validator)
    {
        if (isset($data['password_min_length'])) {
            $validator
                ->add('password_min_length', 'validNumber', [
                    'rule' => ['naturalNumber', false], // false: exclude zero
                    'message' => __d('user', 'Invalid password min-length.')
                ]);
        }

        $validator
            ->requirePresence('message_welcome_subject')
            ->notEmpty('message_welcome_subject', __d('user', 'This field cannot be empty.'))

            ->requirePresence('message_welcome_body')
            ->notEmpty('message_welcome_body', __d('user', 'This field cannot be empty.'))

            ->requirePresence('message_password_recovery_subject')
            ->notEmpty('message_password_recovery_body', __d('user', 'This field cannot be empty.'))

            ->requirePresence('message_cancel_request_subject')
            ->notEmpty('message_cancel_request_body', __d('user', 'This field cannot be empty.'));

        if ($data['message_activation']) {
            $validator
                ->requirePresence('message_activation_subject')
                ->notEmpty('message_activation_body', __d('user', 'This field cannot be empty.'));
        }

        if ($data['message_blocked']) {
            $validator
                ->requirePresence('message_blocked_subject')
                ->notEmpty('message_blocked_body', __d('user', 'This field cannot be empty.'));
        }

        if ($data['message_canceled']) {
            $validator
                ->requirePresence('message_canceled_subject')
                ->notEmpty('message_canceled_body', __d('user', 'This field cannot be empty.'));
        }
    }
public function settingsValidate(Event $event, $data, Validator $validator)
    {
        if (isset($data['password_min_length'])) {
            $validator
                ->add('password_min_length', 'validNumber', [
                    'rule' => ['naturalNumber', false], // false: exclude zero
                    'message' => __d('user', 'Invalid password min-length.')
                ]);
        }

        $validator
            ->requirePresence('message_welcome_subject')
            ->notEmpty('message_welcome_subject', __d('user', 'This field cannot be empty.'))

            ->requirePresence('message_welcome_body')
            ->notEmpty('message_welcome_body', __d('user', 'This field cannot be empty.'))

            ->requirePresence('message_password_recovery_subject')
            ->notEmpty('message_password_recovery_body', __d('user', 'This field cannot be empty.'))

            ->requirePresence('message_cancel_request_subject')
            ->notEmpty('message_cancel_request_body', __d('user', 'This field cannot be empty.'));

        if ($data['message_activation']) {
            $validator
                ->requirePresence('message_activation_subject')
                ->notEmpty('message_activation_body', __d('user', 'This field cannot be empty.'));
        }

        if ($data['message_blocked']) {
            $validator
                ->requirePresence('message_blocked_subject')
                ->notEmpty('message_blocked_body', __d('user', 'This field cannot be empty.'));
        }

        if ($data['message_canceled']) {
            $validator
                ->requirePresence('message_canceled_subject')
                ->notEmpty('message_canceled_body', __d('user', 'This field cannot be empty.'));
        }
    }
public function settingsValidate ( Event $ event , $ data , Validator $ validator ) { if ( isset ( $ data [ 'password_min_length' ] ) ) { $ validator -> add ( 'password_min_length' , 'validNumber' , [ 'rule' => [ 'naturalNumber' , false ] , // false: exclude zero 'message' => __d ( 'user' , 'Invalid password min-length.' ) ] ) ; } $ validator -> requirePresence ( 'message_welcome_subject' ) -> notEmpty ( 'message_welcome_subject' , __d ( 'user' , 'This field cannot be empty.' ) ) -> requirePresence ( 'message_welcome_body' ) -> notEmpty ( 'message_welcome_body' , __d ( 'user' , 'This field cannot be empty.' ) ) -> requirePresence ( 'message_password_recovery_subject' ) -> notEmpty ( 'message_password_recovery_body' , __d ( 'user' , 'This field cannot be empty.' ) ) -> requirePresence ( 'message_cancel_request_subject' ) -> notEmpty ( 'message_cancel_request_body' , __d ( 'user' , 'This field cannot be empty.' ) ) ; if ( $ data [ 'message_activation' ] ) { $ validator -> requirePresence ( 'message_activation_subject' ) -> notEmpty ( 'message_activation_body' , __d ( 'user' , 'This field cannot be empty.' ) ) ; } if ( $ data [ 'message_blocked' ] ) { $ validator -> requirePresence ( 'message_blocked_subject' ) -> notEmpty ( 'message_blocked_body' , __d ( 'user' , 'This field cannot be empty.' ) ) ; } if ( $ data [ 'message_canceled' ] ) { $ validator -> requirePresence ( 'message_canceled_subject' ) -> notEmpty ( 'message_canceled_body' , __d ( 'user' , 'This field cannot be empty.' ) ) ; } }
Validates plugin's settings.

@param \Cake\Event\Event $event The event that was triggered
@param array $data Data to be validated
@param \Cake\Validation\Validator $validator The validator object
@return void
Validates plugin s settings .