Jump to:

5522 Posts in 1734 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » HTML Text name now showing up

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

Page: 1
Go to End
Author Topic: 1179 Views
  • DanStephenson
    Avatar
    Community Member
    115 Posts

    HTML Text name now showing up Link to this post

    Hi everyone,

    I am setting up my first SilverStripe template. I've created a page with 2 custom fields, Sidebar, and Sidebar Feature. In the CMS, I can see that these text areas have been created, but they don't have any labels on them, so the admin knows what to enter. What did I do wrong?

    class Page extends SiteTree {
       static $db = array(
          'Sidebar' => 'HTMLText',
          'SidebarFeature' => 'HTMLText'
       );
       
       static $defaults = array(
       );

       function getCMSFields() {
          $fields = parent::getCMSFields();
          $fields->addFieldToTab('Root.Content.Sidebar', new HTMLEditorField('Sidebar'), 'Sidebar');
          $fields->addFieldToTab('Root.Content.Sidebar', new HTMLEditorField('SidebarFeature'), 'Sidebar Feature');   
          return $fields;
    }
    }

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: HTML Text name now showing up Link to this post

    Your order of parameters is a bit wrong:

    try:

    $fields->addFieldToTab('Root.Content.Sidebar', new HTMLEditorField('Sidebar', 'Sidebar'));
    $fields->addFieldToTab('Root.Content.Sidebar', new HTMLEditorField('SidebarFeature', 'Sidebar Feature'));

    The argument you would put in where you had it originally, is to tell the Tab before which other field the new field should be inserted.

    Hope this helps.

    1179 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.