Jump to:

3450 Posts in 1063 Topics by 738 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Label for Boolean in $searchable_fields

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

Page: 1
Go to End
Author Topic: 457 Views
  • Silverfish
    Avatar
    Community Member
    59 Posts

    Label for Boolean in $searchable_fields Link to this post

    Hi All,

    I can set labels on $searchable_fields() like

    static $searchable_fields = array(
       'FirstName' => array(
          'title' => 'Label 4 FirstName',
          'field' => 'TextField',
       ),
    'IsPaid' => 'Boolean'
    );

    as described in http://doc.silverstripe.org/sapphire/en/reference/dataobject
    But what if I want to set this for the Boolean value, too?
    Since Silverstripe creates a three-value dropdown by default, I tried to set a DropdownField, which works, but I couldn't manage to get the values into it.

    'IsPaid' => array (
       'title' => 'Title 4 paid',
       'field' => 'DropDownField',
       'source' => array('' => '(all)', '0' => 'no', '1' => 'yes' )
    ),
    or
    'IsPaid' => array (
       'title' => 'Title 4 paid',
       'field' => 'DropDownField',
       'field.source' => array('' => '(all)', '0' => 'no', '1' => 'yes' )
    ),

    didn't work.

    Any Hints, anyone?

    Thx in advance
    Regards
    SF

    457 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.