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.

All other Modules /

Discuss all other Modules here.

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

MultiSelectField example


Reply


1165 Views

Avatar
klikhier

Community Member, 150 Posts

25 June 2009 at 8:43pm

For an example of how to use the MultiSelectField module:

static $many_many = array ('Things'=>'ThingPage');

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab(
"Root.Content.Related",
new MultiSelectField(
"Things", // Relationship that the field controls
"Related Things", // Label for field
"ThingPage", // Related class
"ID", // Mapped data field in related class (normally ID)
"Title" // Mapped label field in related class (often Title)
)
);
return $fields;
}