Jump to:

23376 Posts in 18214 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Add new field to tab but under the label.

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

Page: 1
Go to End
Author Topic: 456 Views
  • Trevor Wistaff
    Avatar
    Community Member
    3 Posts

    Add new field to tab but under the label. Link to this post

    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

  • Trevor Wistaff
    Avatar
    Community Member
    3 Posts

    Re: Add new field to tab but under the label. Link to this post

    Can anybody provide some insight?

  • Trevor Wistaff
    Avatar
    Community Member
    3 Posts

    Re: Add new field to tab but under the label. Link to this post

    Bumpity bump

  • vinstah
    Avatar
    Community Member
    2 Posts

    Re: Add new field to tab but under the label. Link to this post

    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

  • kinglozzer
    Avatar
    Community Member
    138 Posts

    Re: Add new field to tab but under the label. Link to this post

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

    456 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.