Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » ToggleCompositeField question (Metadata etc) - 3.01

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

Page: 1
Go to End
Author Topic: 636 Views
  • yurigoul
    Avatar
    Community Member
    202 Posts

    ToggleCompositeField question (Metadata etc) - 3.01 Link to this post

    In sitetree.php I found how the metadata-thingy that is there is created. I suspect one can use it to create ones own. The next question is: How can one remove it? Anybody?

    Thnx!

    ToggleCompositeField::create('Metadata', _t('SiteTree.MetadataToggle', 'Metadata'),
                      array(
                         new TextField("MetaTitle", $this->fieldLabel('MetaTitle')),
                         new TextareaField("MetaKeywords", $this->fieldLabel('MetaKeywords'), 1),
                         new TextareaField("MetaDescription", $this->fieldLabel('MetaDescription')),
                         new TextareaField("ExtraMeta",$this->fieldLabel('ExtraMeta'))
                      )
                   )->setHeadingLevel(4)

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: ToggleCompositeField question (Metadata etc) - 3.01 Link to this post

    Well provided it plays nicely with the form API then you can just remove it like you do any other form fields on your page

    class Page extends SiteTree {
    ..

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->removeByName('Metadata');
    }
    }

  • yurigoul
    Avatar
    Community Member
    202 Posts
    636 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.