5102 Posts in 1520 Topics by 1116 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1048 Views |
-
Headline for CMS Field

18 December 2008 at 12:34pm
I've been working on this for close to two hours. I've used SS many times before, but haven't needed to add a custom field. After an hour I got it to show a new HtmlEditorField, but there is no title set to the field when you look at it in the admin. It works and I can display the content on the page using both $Sidebar_Title and $Sidebar.
I have this and the TextField is showing what I have there, but the HtmlEditorField is not. P.S. this is in the Page class. Yes, i have gone through the tutorials as well about a dozen times
static $db = array(
'Sidebar_Title' => 'Text',
'Sidebar' => 'HTMLText'
);function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab('Root.Content.Main', new TextField('Sidebar Title'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('Sidebar'), 'Content');return $fields;
} -
Re: Headline for CMS Field

18 December 2008 at 6:29pm
For starters, don't use underscores in your variables. Bad naming conventions for SS.
And just add a comma after the name for the title.
So like this:
$fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('Sidebar', 'Some Title'), 'Content');
Cheers,
p.s always look through the api documentation so you can see how everything works in more detail.
| 1048 Views | ||
|
Page:
1
|
Go to Top |


