Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Custom fields not showing on CMS

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1371 Views
  • aquafina
    Community Member
    1 Post

    Custom fields not showing on CMS Link to this post


    I was following http://doc.silverstripe.com/doku.php?id=tutorial:2-extending-a-basic-site. I got the database built fine and I can create new page of type ArticleHolder and ArticlePage. However, when I'm on Article Page, I don't see new fields on CMS. I did flush on both http://mysite/db/build?flush=1 and http://mysite/admin/?flush=1.

    I put the code to override getCMSFields() under mysite/code/ArticlePage.php under ArticlePage_Controller class. It seems like the function is not being called (I checked using syslog() on the function and I don't see anything)

    Any pointers / help is appreciated.

  • Willr
    Forum Moderator
    5497 Posts

    Re: Custom fields not showing on CMS Link to this post

    It should be in the ArticlePage class and NOT the controller. The controller class usually only has methods which are used in the templates. Things like getCMSFields() should be in the top class.

  • kudesign
    Community Member
    64 Posts

    Re: Custom fields not showing on CMS Link to this post

    I still have no luck adding the method to the ArticlePage class, this is my code in code/ArticlePage.php

    * Defines the ArticlePage page type
    class ArticlePage extends Page {
    static $db = array(
    'Date' => 'Date',
    'Author' => 'Text'
    static $has_one = array(
    function getCMSFields() {
    $fields = parent::getCMSFields();

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

    class ArticlePage_Controller extends Page_Controller {



    After db/build?flush=1 and multiple refreshes, it still does not show the Date and Author field when I tried to add a new ArticlePage in CMS. I'm on v2.2.3 What have I done wrong? Help!

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.