-
Notifications
You must be signed in to change notification settings - Fork 917
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
Allow other fields to use subfields
attribute (not just checklist_dependency
)
#4069
Merged
tabacitu
merged 14 commits into
4.2
from
do-not-use-subfields-attribute-only-for-checklist-dependency-field
Jan 14, 2022
Merged
Allow other fields to use subfields
attribute (not just checklist_dependency
)
#4069
tabacitu
merged 14 commits into
4.2
from
do-not-use-subfields-attribute-only-for-checklist-dependency-field
Jan 14, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…o-not-use-subfields-attribute-only-for-checklist-dependency-field
tabacitu
commented
Jan 11, 2022
tabacitu
commented
Jan 11, 2022
tabacitu
commented
Jan 11, 2022
tabacitu
commented
Jan 11, 2022
subfields
attribute (not just checklist_dependency
)
@pxpm this is ready to merge IMHO. Please take a look, review and test. Let me know if I can merge OR you pick up anything wrong with it. |
…dency-field' of https://github.com/Laravel-Backpack/CRUD into rename-fields-to-subfields
…o-not-use-subfields-attribute-only-for-checklist-dependency-field
This is pending #4078 (comment) comment resolution. |
…elds Rename fields to subfields inside `repeatable` and `relationship` field types
Closed
Merged PR #4078 into this one, removing |
…list-dependency-field
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHY
Fixes #4065
BEFORE - What was wrong? What was happening before this PR?
We couldn't use
subfields
forrepeatable
andrelationship
because they were used bychecklist_dependency
in a different way:checklist_dependency
, thesubfields
were treated as regular fields by the CRUD; the twosubfields
were saved creating & updating, NOT the main field;repeatable
andrelationship
we want the main field to be saved, not the subfields (actually, the subfields will be part of the main field because they have the same name as it, just add stuff using bracket notation - eg.testimonial[name]
andcategory[body]
);AFTER - What is happening after this PR?
subfields
can be used the wayrepeatable
andrelationship
want them (as fields with bracket names)subfields
can STILL be used bychecklist_dependency
, because Backpack treats them as regular fields if the field NAME is an array;HOW
How did you achieve that, in technical terms?
In short:
$field['name']
is astring
,subfields
are considered inconsequential;field['name']
is anarray
,subfields
are considered important, are checked for relationships;This is probably not a long-term solution, but it's the only way I've found to mix this in a non-breaking way, without introducing a flag for
checklist_dependency
or anything.It has the added benefit that what we coded for
date_range
helps in this respect. Onlydate_range
andchecklist_dependency
use arrays as field names, and they both need the same functionality: save both inputs in the name array. In addition to thedate_range
field, whatchecklist_dependency
needs extra is for thesubfields
to be checked for relationships, that's it.Is it a breaking change or non-breaking change?
Non-breaking.
How can we test the before & after?
Before - inside the Users CRUD check that roles & permissions work.
After - inside the Users CRUD check that roles & permissions work.
Sidenotes:
repeatable
andrelationship
acceptsubfields
; it just allows them to do so in a different PR;checklist_dependency
; see [Bug] cannot clearchecklist_dependency
field #4071