I have successfully created a gallery landing page that pulls a specified child album cover image to itself. This works perfectly in SS 4.2.1 I then created a new SS 4.3.1 and copied over all the templates. Everything is working except for this Gallery. When I am in the admin interface I can click on the gallery page and there are no error messages but when I click on the child AlbumPage page I get the following error:
[Emergency] Uncaught Error: Call to a member function scaffoldSearchField()
on string
GET /bubbleshop/admin/pages/edit/show/48
Line 2249 in /var/www/silverstripe/bubbleshop/vendor/silverstripe/framework/src/ORM/DataObject.php
Source
2240
2241 // Otherwise we have a bug
2242 } else {
2243 user_error("Bad value for searchable_fields,
'field' value: "
2244 . var_export($spec['field'], true),
E_USER_WARNING);
2245 }
2246
2247 // Otherwise, use the database field's scaffolder
2248 } elseif ($object = $this->relObject($fieldName)) {
2249 $field = $object->scaffoldSearchField();
2250 }
2251
2252 // Allow fields to opt out of search
2253 if (!$field) {
2254 continue;
2255 }
I have managed to identify the code that is causing the error. In the private static $summary_fields I have a Boolean and this below to convert to Yes or No to but I am not sure how to fix it.
public function Cover(){
return ($this->Cover==true ? 'Yes' : ' ');
}
Thanks in advance for taking a look.
Best regards, Lyn