Jump to:

5541 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » CMS field names

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

Page: 1
Go to End
Author Topic: 1370 Views
  • mccarville
    Avatar
    Community Member
    32 Posts

    CMS field names Link to this post

    I saw an old post in the archive that referenced "doing a print_r of getCMSFields()" to get the variable names of all the fields 'parent' fields in the CMS. Does anyone have a copy of this list to post, or can anyone show me how to use this print_r to generate the list??

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: CMS field names Link to this post

    When on the Page class, or a subclass of, you usually have something like this:

    function getCMSFields() {
       $fields = parent::getCMSFields();

       Debug::show($fields);

       $fields->addFieldToTab('Root.Content.Main', new TextField('Author'));

       return $fields;
    }

    The Debug::show($fields) will show you all fields that were automatically added in the CMS, and you can manipulate those as necessary, removing fields that you don't want or adding new ones.

    Cheers,
    Sean

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