I created some custom fields for a promo slider on a website home page. No data will save to these fields (well, they save to the image ones but not to the text or HTMLText ones. My code is below:
class HomePage extends Page {
static $db = array(
);
static $has_one = array(
'Promo1' => 'Image',
'Promo2' => 'Image',
'Promo3' => 'Image',
'PromoText1' => 'HTMLText',
'PromoText2' => 'HTMLText',
'PromoText3' => 'HTMLText',
'PromoName1' => 'Text',
'PromoName2' => 'Text',
'PromoName3' => 'Text',
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab("Root.Content.Main","Content");
$fields->addFieldToTab('Root.Content.Main', new TextField('PromoName1'));
$fields->addFieldToTab('Root.Content.Promos', new HtmlEditorField($name = "PromoText1",$title = "Promo Text 1"));
$fields->addFieldToTab('Root.Content.Promos', new ImageField('Promo1'));
$fields->addFieldToTab('Root.Content.Promos', new TextField('PromoName2'));
$fields->addFieldToTab('Root.Content.Promos', new HtmlEditorField($name = "PromoText2",$title = "Promo Text 2"));
$fields->addFieldToTab('Root.Content.Promos', new ImageField('Promo2'));
$fields->addFieldToTab('Root.Content.Promos', new TextField('PromoName3'));
$fields->addFieldToTab('Root.Content.Promos', new HtmlEditorField($name = "PromoText3",$title = "Promo Text 3"));
$fields->addFieldToTab("Root.Content.Promos", new ImageField('Promo3'));
return $fields;
}
}
Any thoughts would be helpful. The database is accepting content added to pages without my custom fields, so I know it is an issue with something I wrote...