I'm using GridFieldHasOneRelationHandler to select a featured Gallery Image. Here's my code:
$featuredGalleryGridConfig = GridFieldConfig_RecordViewer::create(); $featuredGalleryGridConfig->addComponent(new GridFieldHasOneRelationHandler($this, 'FeaturedGalleryImage')); $featuredGalleryGridField = new GridField('FeaturedGalleryImageID', 'Featured Gallery Image', GalleryImage::get(), $featuredGalleryGridConfig); $fields->addFieldToTab('Root.FeaturedGalleryImage', $featuredGalleryGridField);
This seems to be causing a problem with pagination. I can change the selected image on the first page of the GridField, but if I try to navigate to the next GridField page, I get an error. The log says:
Warning at \framework\forms\gridfield\GridState.php line 113: Cannot use a scalar value as an array (http://localhost/susangreenfield.com/admin/pages/edit/EditForm/field/FeaturedGalleryImageID)
Oddly, if I change the GridField field from 'FeaturedGalleryImageID' to 'FeaturedGalleryImage', I can view the relationship, navigate the GridField pages, but changes won't save, though there is no error in the log.