Hey Guys
I have extended the Event Calendar in similar ways to the recipe in the docs http://doc.silverstripe.org/doku.php?id=recipes:extending_the_event_calendar but I'm having an issue adding an extra Filter Dropdown field (under the Calendar Widget) and getting it to work.
Basically, in the context of the tutorial/recipe I linked to, I want to be able to filter by Instructor.
That is, I have a many_many relationship between CalendarDateTime.php and Instructor.php and I would like to add a drop down field of Instructors under the existing From and To Calendar Filter dropdowns.
I got to here:
public function getFilterFields() {
$fields = parent::getFilterFields(); // returns a CalendarFilterFieldSet
$instructors = DataObject::get('Instructor');
$map = $instructors ? $instructors->toDropdownMap('ID','Name') : array();
$fields->addFilterField(new DropdownField('CalendarDateTime_Instructors','Instructor', $map));
return $fields;
}
but as I expected it's looking in the db for an "Instructors" column in the CalendarDateTime table (which it doesn't find and so errors) rather than matching it up via a joint CalendarDateTime_Instructors table.
Is what I'm trying to do possible?