I'm trying to put together a simple page type that will have a dropdown of days of the week that is pulled from a set of enum values. Here is my code thus far:
<?php
class EveningPage extends Page {
static $db = array(
'Day' => "Enum('Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday','Monday')",
'StartDate' => 'Date',
'EndDate' => 'Date',
'Comments' => 'Text'
);
function getCMSFields() {
$fields = parent::getCMSFields();
//This is where I need help
$fields->addFieldToTab('Root.Content.Main', new DropdownField(
'Day',
'Day of the Week:',
singleton('EveningPage')->dbObject('Day')->enumValues()
),
$fields->removeFieldFromTab("Root.Content.Main","Content"); //Remove the content field
return $fields;
}
}
class EveningPage_Controller extends Page_Controller {
}
?>
This is not working, and I'm sure I have some things screwy, but I couldn't find much in the way of documentation for this sort of thing. Can anyone help... thanks so much!