public function validationCustom(Validator $validator)
    {
        return $this->validationWidget($validator)
            ->requirePresence('body')
            ->add('body', [
                'notBlank' => [
                    'rule' => 'notBlank',
                    'message' => __d('block', "You need to provide a content for block's body."),
                ],
                'length' => [
                    'rule' => ['minLength', 3],
                    'message' => __d('block', "Block's body need to be at least 3 characters long."),
                ],
            ]);
    }
public function validationCustom(Validator $validator)
    {
        return $this->validationWidget($validator)
            ->requirePresence('body')
            ->add('body', [
                'notBlank' => [
                    'rule' => 'notBlank',
                    'message' => __d('block', "You need to provide a content for block's body."),
                ],
                'length' => [
                    'rule' => ['minLength', 3],
                    'message' => __d('block', "Block's body need to be at least 3 characters long."),
                ],
            ]);
    }
public function validationCustom ( Validator $ validator ) { return $ this -> validationWidget ( $ validator ) -> requirePresence ( 'body' ) -> add ( 'body' , [ 'notBlank' => [ 'rule' => 'notBlank' , 'message' => __d ( 'block' , "You need to provide a content for block's body." ) , ] , 'length' => [ 'rule' => [ 'minLength' , 3 ] , 'message' => __d ( 'block' , "Block's body need to be at least 3 characters long." ) , ] , ] ) ; }
Validation rules for custom blocks.

Plugins may define their own blocks, in these cases the "body" value is
optional. But blocks created by users (on the Blocks administration page)
are required to have a valid "body".

@param \Cake\Validation\Validator $validator The validator object
@return \Cake\Validation\Validator
Validation rules for custom blocks .