\SliceDetailsForm_ItemRequest
Slice GridField Details Form
This handles the template->className mapping that is possible with slices. SilverStripe's
default details form only handles class names changing on submit when the field ClassName
exists in the form submission and differs from the target record's class name in the database.
Record instances need to be consistent with their ClassName field at save, and particularly
when re-rendering the CMS fields, so that the instance code and the config returned Object::config()
are compatible. Object::config() uses get_called_class(), which makes it return the config for
the old class if the instance is not recreated, causing non-sense looking errors.
Synopsis
class SliceDetailsForm_ItemRequest
extends VersionedDataObjectDetailsForm_ItemRequest
{
- // methods
- public void __construct()
- public void publish()
- public void save()
- protected void updateRecordClass()
- protected bool hasRecordChangedClass()
Hierarchy
Extends
- Heyday\VersionedDataObjects\VersionedDataObjectDetailsForm_ItemRequest
Methods
protected
- hasRecordChangedClass() — Check if the target record's ClassName field is in sync with its record instance
- updateRecordClass() — Create a new instance of the form record using the class configured for a template name