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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Add new field to tab but under the label.


Reply

5 Posts   493 Views

Avatar
Trevor Wistaff

15 October 2012 at 3:11pm Community Member, 3 Posts

I added new HtmlEditorField(s) to the main tab and all is fine.

However, the label for the field is floated to the left instead of sitting above the field like the default "Content" field.

Cheers,

Trev

Avatar
Trevor Wistaff

21 October 2012 at 1:10pm Community Member, 3 Posts

Can anybody provide some insight?

Avatar
Trevor Wistaff

29 October 2012 at 5:50pm Community Member, 3 Posts

Bumpity bump

Avatar
vinstah

11 June 2013 at 9:54pm (Last edited: 11 June 2013 9:57pm), Community Member, 2 Posts

Hello,

I too was looking into how to make the HTMLEditorField underneath the label, and after playing around with CSS in Developer Tools in FireFox,
I have found out that the default "Content" Field has a class named "stacked" added to the

<div id="Content" class="field htmleditor stacked">

but in the other HTMLEditorField(s) that developers add using $fields don't. I will figure out how to get those added by $field stacked and let you know how I go.

for now you can add custom javascript

$('#Content').addClass('stacked');

where #Content is the id of the div you added

Avatar
kinglozzer

11 June 2013 at 10:32pm Community Member, 146 Posts

You don't need to use Javascript to add a class at all.

In getCMSFields(), do the following:

$myField = new HTMLEditorField('MyHTMLField', 'My HTML Field');
$myField->addExtraClass('stacked');