-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for nested block validation #2638
base: 3.x
Are you sure you want to change the base?
Add support for nested block validation #2638
Conversation
Awesome @antonioribeiro. I'd like to merge this, but the tests are showing that this broke the blocks list command, as it is trying to render the new property you added here. |
d0c5edd
to
05f2865
Compare
Hey ifox, tests pass locally, but manually running the command did give me that error. I just removed the messages from the list, did some other testing here and it seems all good. Waiting for the tests to finishing running on Github |
05f2865
to
3de13f4
Compare
3de13f4
to
f29cb91
Compare
$finalValidator->getMessageBag()->add("blocks.$id" . "[$key][$locale]", $error); | ||
$finalValidator->getMessageBag()->add("blocks.$locale", 'Failed'); | ||
} | ||
} | ||
} | ||
} | ||
foreach ($basicRules as $field => $rules) { | ||
$validator = Validator::make([$field => $formData[$field] ?? null], [$field => $rules]); | ||
$validator = Validator::make($formData, [$field => $rules], $messages); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we just drop the foreach
loop at this point and pass $basicRules
directly to the validator?
I just ran into the same issue validating fields and media browsers within a repeater of a block, thought I couldn't be the first and found this PR, so thank you for that 😄
Description
Adds support not only to validate neste blocks, but also for custom messages, all to be set within the block.
Here's how it presents itself:
Here's a full block example of it working:
Related Issues
Fixes #1850