Closed Zauberfisch closed 7 years ago
Also: any chance we can get a fix - should one be created by then - into the ss 4.0 release?
I feel like this is a rather significant change, as some modules or form fields might have worked around that in the past in hackish ways (such as HTMLEditorField_Toolbar), so it would make sense to have module developers update (if needed) to this new way now where they have to update anyway to support 4.
This has been fixed in SS4 — do you want check out alpha7 which is being released right now?
I haven't tested it yet, but from looking at the code it does indeed look like it has been fixed.
Or at least almost. Because the checking of ?ID=
is still inside LeftAndMain->currentPageID().
Do we have a specific reason why we are keeping that check in place? Is that perhaps still used when a form is submitted or something?
Note that the "current page" state of GridFields in SiteTree->getCMSFields()
has been fixed in 3.6 through https://github.com/silverstripe/silverstripe-cms/commit/487235f9918b762f9eadcaaa655602da884807a6
Yes, the $this->getRequest()->requestVar('ID')
is needed for form submissions.
As far as I see, form submission would now also include the ID in the URL, therefore requestVar() is not used by core at all anymore. So I assumed we are keeping it in for legacy reasons. But would very much appreciate removing it.
Yeah it would be nice to avoid the duplicate means to identify a record. I don't see how they'd get out of sync at the moment, so it's a low priority issue in my mind.
Currently LeftAndMain->currentPageID() currently checks
$this->getRequest()->requestVar('ID')
for an ID of the current page.When first opening a page everything is the way it should be:
/admin/pages/edit/show/2
, but SilverStripe Forms and FormFields are all request handlers that potentially could have have one more more nested sub request handlers. But once we want to access one of those request handlers (egGridField
,HTMLEditorField
,UploadField
) the path will become/admin/pages/edit/EditForm/field/MyGridField/item/new
(this example is the resulting path for adding a new record in a GridField). Note the absence of the current page ID. At this time, the current page is actually saved into session or in some situation also take from hidden form inputs.This issue in LeftAndMain - presumably a relic from older SilverStripe versions (new features such as the GridField handle this correctly for their children) - brings several problems that are completely avoidable: