5121 Posts in 1527 Topics by 1119 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1077 Views |
-
HTML Text name now showing up

31 January 2009 at 1:08pm
Hi everyone,
I am setting up my first SilverStripe template. I've created a page with 2 custom fields, Sidebar, and Sidebar Feature. In the CMS, I can see that these text areas have been created, but they don't have any labels on them, so the admin knows what to enter. What did I do wrong?
class Page extends SiteTree {
static $db = array(
'Sidebar' => 'HTMLText',
'SidebarFeature' => 'HTMLText'
);
static $defaults = array(
);function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Sidebar', new HTMLEditorField('Sidebar'), 'Sidebar');
$fields->addFieldToTab('Root.Content.Sidebar', new HTMLEditorField('SidebarFeature'), 'Sidebar Feature');
return $fields;
}
} -
Re: HTML Text name now showing up

1 February 2009 at 3:34am
Your order of parameters is a bit wrong:
try:
$fields->addFieldToTab('Root.Content.Sidebar', new HTMLEditorField('Sidebar', 'Sidebar'));
$fields->addFieldToTab('Root.Content.Sidebar', new HTMLEditorField('SidebarFeature', 'Sidebar Feature'));The argument you would put in where you had it originally, is to tell the Tab before which other field the new field should be inserted.
Hope this helps.
| 1077 Views | ||
|
Page:
1
|
Go to Top |

