Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » $fields->addFieldToTab not working ver 2.3 RC3

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

Page: 1
Go to End
Author Topic: 2158 Views
  • BuddhaSource
    Avatar
    Community Member
    57 Posts

    $fields->addFieldToTab not working ver 2.3 RC3 Link to this post

    Hi,

    Well custom Fields is not working for me in 2.3 rc2 and RC3 but working just fine in ver 2.2.3

    I wanted to know if I am doing somthing wrong or there is a bug.
    The database all get created when we do db flush etc but in the admin end
    all I see is the empty tab with no field.
    Also RemoveTab is working fine.

    Here is my code sniped.

    My whole work has come to stop cause of this.

    function getCMSFields() {
           $fields = parent::getCMSFields();
          
             $fields->addFieldToTab('Root.Content.SidebarText', new HtmlEditorField('SidebarText'), 'SidebarText');
           $fields->addFieldToTab("Root.Content.SidebarText", new ImageField('Image1'),'content');
           $fields->addFieldToTab("Root.Content.SidebarText", new ImageField('Image2'),'content');
           $fields->addFieldToTab("Root.Content.SidebarText", new ImageField('Image3'),'content');
           $fields->addFieldToTab('Root.Content.SidebarText', new HtmlEditorField('SidebarTextBottom'), 'SidebarTextBottom');
              
           return $fields;
          }   

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: $fields->addFieldToTab not working ver 2.3 RC3 Link to this post

    Hi,

    Do you have a 'content' field in the SidebarText tab?

    You're doing:

    $fields->addFieldToTab("Root.Content.SidebarText", new ImageField('Image1'),'content');

    Which would only make sense if you want to add it before the 'content' field (note it's really 'Content').
    If you don't have a content field in that tab, try with leaving out 'content'.

    It might be a bug or possibly 2.3 RC3 has become a bit stricter and doesn't allow this kind of error anymore.

  • BuddhaSource
    Avatar
    Community Member
    57 Posts

    Re: $fields->addFieldToTab not working ver 2.3 RC3 Link to this post

    Thanks dio5

    2.3 RC3 has become stricter

    The solution was to simply remove content and keep it empty.
    Finally all set and ready to start working.

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