Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

[SOLVED]DateField Call to undefined function setConfig


Go to End


2 Posts   1008 Views

Avatar
Cgull

Community Member, 23 Posts

13 January 2013 at 1:16am

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;
	}
}

Avatar
Cgull

Community Member, 23 Posts

13 January 2013 at 1:27am

Ok, found my mistake:

$dateField = setConfig...
should be
$dateField->setConfig...

Ooops