Skip to main content
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
i have a problem when i want to translate page which inlude DropdownField
"Fatal error: Call to a member function toDropdownMap() on a non-object in /home/wilgocki/domains/wilgocki.net/public_html/silverstripe/mysite/code/TourPage.php on line 76"
Somewhere in TourPage.php, you're doing something like this:
Unless you're 100% sure that "Something" will not return a null set, you shouldn't run a method on that output. A better practice is this:
$stuff = DataObject::get("Something");
$map = $stuff? $stuff->toDropdownMap() : array();
return new DropdownField('Name','Title', $map);