Overriding FieldtypePage/InputfieldPage->derefAsPage in template breaks field
Short description of the issue
Page Reference fields break completely when overriding derefAsPage from Multiple to Single.
The other way around, overriding from Single to Multiple, it doesnt let you save more than one reference.
Steps to reproduce the issue
- Create a field of type Page Reference with value type Multiple / PageArray (i am using Page Auto Complete as input method)
- Enable overriding value type (derefAsPage)
- Add field to template
- a) 4. In the template settings, override derefAsPage to Single Page 5. Edit a page with the template, click save 6. Out of memory because infinite recursion
- b) 4. Edit page and add some pages as field value, save page 5. In the template settings, override derefAsPage to Single Page 6. Try to edit the page again
Setup/Environment
ProcessWire version: 3.0.210
Confirmed. I get error `Method Page::add does not exist or is not callable in this context (in /wire/core/Wire.php line 563) and I can't edit a page (The process returned no content.).
Yeah, in theory there is some Is PageArray but should be Page in the value handling, but ultimately it seems neither wakeup/sleep conversion nor the override itself work as intended. So far i haven't tracked it down further.
The override list shows all settings used by the field, but only those in bold are supported and known to work. Any others are YMMV... they might work or they might not (per the note in the Overrides tab). The derefAsPage is not a setting that is known to work, and I'm not sure it can be, but happy to look at it closer. But since we're trying to reduce the issues list here to just bugs, and this isn't a bug, maybe we should move this one to the feature requests list.
If its just a matter of the value handling i'd be happy to help.
I'm not sure how (and where) the field configuration works. Are overrides uniformly applied on field object initialization?