Jump to:

5449 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » multilanuage non-object problem

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 988 Views
  • snaip
    Avatar
    Community Member
    180 Posts

    multilanuage non-object problem Link to this post

    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"


  • UncleCheese
    Avatar
    4085 Posts

    Re: multilanuage non-object problem Link to this post

    Somewhere in TourPage.php, you're doing something like this:

    DataObject::get("Something")->toDropDownMap();

    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);

  • snaip
    Avatar
    Community Member
    180 Posts

    Re: multilanuage non-object problem Link to this post

    great ! thanks

    988 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.