Jump to:

5451 Posts in 1673 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » problem with addfieldstotab in 2.3.3

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

Page: 1
Go to End
Author Topic: 1292 Views
  • mtz
    Avatar
    Community Member
    17 Posts

    problem with addfieldstotab in 2.3.3 Link to this post

    I have a Problem adding Fields to a existing Tab.
    My Code is

    public function getCMSFields()
       {
          $f = parent::getCMSFields();
          
          
          $f->addFieldsToTab("Root.Content.Right Box", new TextField('RightTitle','Right Title'), 'Content');
          $f->addFieldsToTab("Root.Content.Right Box", new HtmlEditorField('RightColumn','Content'), 'Content');
          
    return $f;
    }

    I get two Tabs named Right Box. How can i add the new HtmlEditorField in the Right Box tab above?

    I did it this way in SS 2.2 and it was working.

    Am i blind?

  • mtz
    Avatar
    Community Member
    17 Posts

    Re: problem with addfieldstotab in 2.3.3 Link to this post

    OK helps talk about.

          $f->addFieldsToTab("Root.Content.Right Box", new TextField('RightTitle','Right Title'), 'Content');

    it must be "Root.Content.RightBox" instead...

  • banal
    Avatar
    Community Member
    901 Posts

    Re: problem with addfieldstotab in 2.3.3 Link to this post

    AFAIK there are two different functions to add Fields to a tab.
    One is called addFieldToTab and expects parameters as you set them, the other one is addFieldsToTab and it expects an array of fields as the second parameter (and it ignores the third parameter).

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