Silverstripe Version: 4*
I’m trying to add an option for title color in BlogPost summary view.
I added the Enum field to database and I want to add the dropdown / select field under BlogPost title.
I’m not sure which field type to use and how to set it properly.
class BlogPostExtension extends DataExtension
{
private static $db = [
'ArchiveDate' => 'Date',
'TitleColor' => "Enum(array('black','red','green'))" // works only with this syntax
];
private static $defaults = [
'TitleColor' => 'black'
];
public function updateCMSFields(FieldList $fields)
{
$fields->push(new DateField('ArchiveDate', 'Archive date'));
$fields->push(new DropdownField('TitleColor','Color')); // doesn't populate the dropdown field
// $fields->push(new SelectField('TitleColor','Color')); // cannot instantiate abstract class 'SelectField'
}
}