You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #7136 Fix hiding and showing of fields in AssociationField and CollectionFi… (michaelKaefer)
This PR was merged into the 4.x branch.
Discussion
----------
Fix hiding and showing of fields in AssociationField and CollectionFi…
…eld if crud form is used
`FieldFactory` removes configured fields by checking against the current page (for example `Crud::PAGE_NEW`) here: `$fieldDto->isDisplayedOn($currentPage)`.
Now consider using one of:
- `AssociactionField::new(...)->renderAsEmbeddedForm()`
- `CollectionField::new(...)->useEntryCrudForm()`
`FieldFactory` gets the `$currentPage` of the request: `$this->adminContextProvider->getContext()->getCrud()->getCurrentPage()`. If there are nested CRUD forms (like in the 2 above examples) there have to be multiple current pages. One for the root entity and one for every nested CRUD form. For example when editing (`Crud::PAGE_EDIT`) the root entity we can add new (`Crud::PAGE_NEW`) items to a collection.
This is not possible and a partial fix was introduced in #5704 and edited in #7061. This fix produced another error (for example removing fields on `index` pages, I can elaborate if necessary).
This PR reverts the partial fixes and adds a new fix by passing different `$currentPage` to `FieldFactory` a) for the root entity and b) for nested CRUD forms.
Commits
-------
5bc8490 Fix hiding and showing of fields in AssociationField and CollectionField if crud form is used
0 commit comments