Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

HTMLEditorField on a Tab


Go to End


4 Posts   3824 Views

Avatar
merrick_sd

Community Member, 99 Posts

19 February 2010 at 4:15am

Is it possible to have a htmlEditor filed on a tab?

I have got it display in Main by changing to
$fields->addFieldToTab("Root.Content.Main", new HTMLEditorField('TeaserText'), 'Content');

But on a tab is no go?

I can get tick boxes an whatever else, but can't seem to get a htmlEditor to display within a tab.

public static $db = array(

'TeaserText' => 'HTMLText'
);

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab("Root.Content.RightContent", new HTMLEditorField('TeaserText'), 'Content');

return $fields;
}

Avatar
Willr

Forum Moderator, 5523 Posts

19 February 2010 at 10:35am

It could be because you're trying to insert the field before the 'Content' field but no field called content exists on that tab. Try not inserting the field above anything and see if it appears.

$fields->addFieldToTab("Root.Content.RightContent", new HTMLEditorField('TeaserText'));

Avatar
merrick_sd

Community Member, 99 Posts

19 February 2010 at 11:04pm

fantastic that worked. Many thanks

I thought the second 'Content' bit was giving it a label rather than ordering.

Avatar
Willr

Forum Moderator, 5523 Posts

20 February 2010 at 10:41am

No, to give it a label you need to pass 'Content' as the argument to HTMLEditorField.

$fields->addFieldToTab("Root.Content.RightContent", new HTMLEditorField('TeaserText', 'Content'));