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.

Customising the CMS /

Silverstripe 3.0: Fetch a Listbox field which has not been created in database


Reply


370 Views

Avatar
Neelam

Community Member, 15 Posts

8 June 2013 at 4:22am

Edited: 08/06/2013 4:32pm

I have used DataExtension on Group Class and the canView() function to hide certain groups based on conditions

But this canView is not applied to the groups listbox which is applied while editing a member/ or group drop down while adding new groups

So I need to set the source of the list box through code

I used

updateCMSFields(FieldList $fields){

$grplisting = $fields->dataFieldByName('DirectGroups'); ...

}

but this is not returning anything so i am not able to use $grplisting->setSource() on it....to filter the source based on the canView conditions also...

can some one please help me out on how I can show the filtered group values in this drop down?

Note: As far as I have observed this field is not created in the database and involves a $belongs_many_many relationship..i have also tried using $fields->fieldByName()