Commit 3d057fe
committed
Skip CollectionField entry-type setup on INDEX/DETAIL pages
CollectionConfigurator::configureEntryType() instantiates the target CRUD
controller and calls configureFields(PAGE_EDIT) on it (or PAGE_NEW) so it can
build entry_type/prototype options. These options are only consumed when the
field is rendered as a form (i.e. on NEW/EDIT pages); on INDEX/DETAIL the
field falls back to formatCollection() which only reads the value and a
custom option.
Running configureFields(PAGE_EDIT) on the target controller while displaying
the parent entity's DETAIL page does not just waste work: it also runs the
user's configureFields() with no real entity instance available, which makes
controllers that legitimately read $context->getEntity()->getInstance()
inside configureFields() crash on a NULL entity (#7460).
Bail out early when the current action is neither EDIT nor NEW so the form
setup only happens on the pages that actually need it.1 parent 0846e65 commit 3d057fe
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
128 | 138 | | |
129 | 139 | | |
130 | 140 | | |
| |||
0 commit comments