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   558 Views

Avatar
Trevor Wistaff

Community Member, 3 Posts

15 October 2012 at 3:11pm

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

Community Member, 3 Posts

21 October 2012 at 1:10pm

Can anybody provide some insight?

Avatar
Trevor Wistaff

Community Member, 3 Posts

29 October 2012 at 5:50pm

Bumpity bump

Avatar
vinstah

Community Member, 2 Posts

11 June 2013 at 9:54pm

Edited: 11/06/2013 9:57pm

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

Community Member, 175 Posts

11 June 2013 at 10:32pm

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');