-
Notifications
You must be signed in to change notification settings - Fork 822
Changes required for the dependent dropdown field #11906
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
base: 6
Are you sure you want to change the base?
Changes required for the dependent dropdown field #11906
Conversation
fe3ff59 to
be9a09a
Compare
a43b4c6 to
4dfc114
Compare
4dfc114 to
b0525ef
Compare
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.
The API here was moved into FieldSetTrait
| $this->fieldNameError($field, __FUNCTION__); | ||
| $this->fieldNameError($field, 'saveableFields'); |
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.
__FUNCTION__ is the anonymous function - we want the name of the method.
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.
API here is from CompositeField and therefore can't be strictly typed without breaking BC
4f6a6da to
bea37d1
Compare
Currently this is managed through dataFieldByName() and recursiveWalk() - but those both rely on the field with children explicitly being a CompositeField. I don't want to rely on these, because: 1. recalculating the children fields for the new dependency field (see admin PR) may be computationally expensive in some scenarios and we want to avoid calling it too much. 2. allowing access to children fields too widely for the new field will cause all sorts of problems, e.g. calling `replaceField()` or `renameField()` on a FieldList.
CompositeField has API that lets it change between a `div` and a HTML `fieldset`. Moving this into a trait lets other fields behave the same way without having to inherit everything about CompositeField.
This can be useful for checking the current class the dropdown holds, similar to `getSourceObject()` on a tree dropdown
bea37d1 to
88d27da
Compare
Important
There are multiple commits on purpose. DO NOT SQUASH
Adds new
FormField::SCHEMA_DATA_TYPE_STRUCTURAL_CUSTOMconst.Not strictly necessary as we could just refer to it as a hardcoded string in the admin PR - but adding this here seems consistent with the other
SCHEMA_DATA_TYPEconsts (which one day maybe we'll turn into an enum)Adds a new interface and uses it in various places to allow the following behaviours for weirdly-nested fields (in a way that doesn't break that nesting e.g. intentionally doesn't find them for reordering or removing fields):
TreeDropdownField'streeaction)Not strictly necessary but allows for the new dependent composite field to be a div or a fieldset depending on the use case. Nice to have.
Makes testing the admin PR easier and seems like sensible API to add, but I can work around it if there's any controversy about it.
Of these only 2 and 5 are strictly necessary - but the others make the implementation and tests a little cleaner.
I have also raised #11927 to eventually use the new
ChildFieldManagerinterface inMoneyField.Issue