Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » HTMLEditorField on a Tab

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

Page: 1
Go to End
Author Topic: 2491 Views
  • merrick_sd
    Avatar
    Community Member
    94 Posts

    HTMLEditorField on a Tab Link to this post

    Is it possible to have a htmlEditor filed on a tab?

    I have got it display in Main by changing to
    $fields->addFieldToTab("Root.Content.Main", new HTMLEditorField('TeaserText'), 'Content');

    But on a tab is no go?

    I can get tick boxes an whatever else, but can't seem to get a htmlEditor to display within a tab.

    public static $db = array(
          
          'TeaserText' => 'HTMLText'
          );

    function getCMSFields() {
          $fields = parent::getCMSFields();
          
       $fields->addFieldToTab("Root.Content.RightContent", new HTMLEditorField('TeaserText'), 'Content');
       
          return $fields;
             }

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: HTMLEditorField on a Tab Link to this post

    It could be because you're trying to insert the field before the 'Content' field but no field called content exists on that tab. Try not inserting the field above anything and see if it appears.

    $fields->addFieldToTab("Root.Content.RightContent", new HTMLEditorField('TeaserText'));

  • merrick_sd
    Avatar
    Community Member
    94 Posts

    Re: HTMLEditorField on a Tab Link to this post

    fantastic that worked. Many thanks

    I thought the second 'Content' bit was giving it a label rather than ordering.

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: HTMLEditorField on a Tab Link to this post

    No, to give it a label you need to pass 'Content' as the argument to HTMLEditorField.

    $fields->addFieldToTab("Root.Content.RightContent", new HTMLEditorField('TeaserText', 'Content'));

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