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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

CheckboxSetField to show dataobjects on a page in ss 3.0

Go to End


tee 1977

Community Member, 6 Posts

22 August 2013 at 3:21am

On a previous site using silverstripe 2.4 i followed a tutorial to allow team profiles to be administered in the model admin which then allowed me to go into the admin and select the profiles per page via a checkbox:

Because dataobject manager is deprecated i cant seem to replicate this in SS3.0. I can get the dataobjects to view in Model Admin but cant get the admin page to view on the relevent page to show all the profiles with checkboxes.

The code i have so far is:

class TeamProfile extends Page {

	public static $db = array(

	public static $has_one = array(
	public static $many_many = array(
		 'TheTeams' => 'TheTeam'
	static $has_many = array(
	function getCMSFields() {
		$fields = parent::getCMSFields();
		$fields->removeFieldFromTab("Root.Main", 'Content');
		/*$fields->addFieldToTab('Root.Content.Banner', new ImageField('BannerImage','Banner Image'));*/
		 $gridFieldConfig = GridFieldConfig::create()->addComponents(
      new GridFieldToolbarHeader(),
      new GridFieldAddNewButton('toolbar-header-right'),
      new GridFieldSortableHeader(),
      new GridFieldDataColumns(),
      new GridFieldPaginator(10),
      new GridFieldEditButton(),
      new GridFieldDeleteAction(),
      new GridFieldDetailForm()

		$config = GridFieldConfig_RelationEditor::create(); 
		$config->addComponent(new GridFieldSortableRows('SortOrder'));
            $config->addComponent(new GridFieldBulkEditingTools());
            $config->addComponent(new GridFieldBulkImageUpload());
	$theteams= DataObject::get('TheTeam');
        if (!empty($theteams)) {
            // create an array('ID'=>'Name')
            $map = $theteams->toDropdownMap('ID', 'SpecialistName');
            // create a Checkbox group based on the array
                new CheckboxSetField(
                    $boxname = "TheTeams",
                    $title = "Select Team Members",
                    $source = $map

			 return $fields;


class TeamProfile_Controller extends Page_Controller {

Please help, Im hoping its just a case of amending the dataobject code at the bottom