Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » [SOLVED]DateField Call to undefined function setConfig

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

Page: 1
Go to End
Author Topic: 355 Views
  • Cgull
    Avatar
    Community Member
    23 Posts

    [SOLVED]DateField Call to undefined function setConfig Link to this post

    Please help,
    Installed SS 3.0.3, using WAMP 2.1

    Following tutorial 2, added a date field to the ArticlePage, trying to create a page of type ArticlePage, getting this error:
    Fatal error: Call to undefined function setConfig() in C:\wamp\www\clunysilver\mysite\code\ArticlePage.php on line 14

    My code:

    class ArticlePage extends Page
    {
       static $db = array(
        'Date'=>'Date',
        'Author'=>'Text'
    );

       public function getCMSFields()
       {
          $fields = parent::getCMSFields();
          
          $dateField = new DateField('Date', 'Article Date');
          $dateField = setConfig('showcalendar', true);
          $fields->addFieldToTab('Root.Main', $dateField);
          $fields->addFieldToTab('Root.Main', new TextField('Author'));
          
          return $fields;
       }
    }

  • Cgull
    Avatar
    Community Member
    23 Posts

    Re: [SOLVED]DateField Call to undefined function setConfig Link to this post

    Ok, found my mistake:

    $dateField = setConfig...

    should be

    $dateField->setConfig...

    Ooops

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