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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

Label for Boolean in $searchable_fields


Go to End


1256 Views

Avatar
Silverfish

Community Member, 59 Posts

1 December 2011 at 12:44am

Edited: 01/12/2011 12:45am

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