5099 Posts in 1519 Topics by 1116 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1045 Views |
-
SS3: updateCMSFields() for Custom Site Config

26 July 2012 at 4:13am
I get this error on SS3 with my custom site config
Declaration of CustomSiteConfig::updateCMSFields() should be compatible with that of DataExtension::updateCMSFields()
This is my Custom Site Config
class CustomSiteConfig extends DataExtension {
static $db = array(
//Business Info
'BusinessName' => 'Varchar',
'StreetAddress' => 'Varchar',
'City' => 'Varchar',
'Province' => 'Varchar',
'PostalCode' => 'Varchar',
'PhoneNumber' => 'Varchar',
'FaxNumber' => 'Varchar',
'MainEmail' => 'Varchar',
'SiteEmail' => 'Varchar',
//Social Media
'Twitter' => 'Varchar',
'FacebookURL' => 'Varchar',
'GooglePlusURL' => 'Varchar',
'PinterestURL' => 'Varchar',
'YouTubeURL' => 'Varchar',
//About Info
'About' => 'HTMLText'
);static $has_one = array(
'Picture' => 'Image'
);public function updateFormFields(FieldList &$fields) {
$fields->addFieldToTab("Root.Main", new TextField("BusinessName"));
$fields->addFieldToTab("Root.Main", new TextField("StreetAddress"));
$fields->addFieldToTab("Root.Main", new TextField("City"));
$fields->addFieldToTab("Root.Main", new TextField("Province"));
$fields->addFieldToTab("Root.Main", new TextField("PostalCode"));
$fields->addFieldToTab("Root.Main", new TextField("PhoneNumber"));
$fields->addFieldToTab("Root.Main", new TextField("FaxNumber"));
$fields->addFieldToTab("Root.Main", new EmailField("MainEmail", 'Main Contact Email'));
$fields->addFieldToTab("Root.Main", new EmailField("SiteEmail", 'Email for Contact Forms'));
$fields->addFieldToTab("Root.Main", new UploadField("Picture"));
$fields->addFieldToTab("Root.Main", new HtmlEditorField("About", "Sidebar About Copy"));
$fields->removeByName('Tagline');
$fields->addFieldToTab("Root.SocialMedia", new TextField("Twitter", 'Twitter User Name'));
$fields->addFieldToTab("Root.SocialMedia", new TextField("FacebookURL", 'Facebook URL'));
$fields->addFieldToTab("Root.SocialMedia", new TextField("GooglePlusURL", 'Google+ URL'));
$fields->addFieldToTab("Root.SocialMedia", new TextField("PinterestURL", 'Pinterest URL'));
$fields->addFieldToTab("Root.SocialMedia", new TextField("YouTubeURL", 'YouTube URL'));}
} -
Re: SS3: updateCMSFields() for Custom Site Config

26 July 2012 at 8:31am
Remove the ampersand from updateFormFields(FieldList &$fields).
-
Re: SS3: updateCMSFields() for Custom Site Config

27 July 2012 at 1:21am
Okay, that fixed the error, but the Fields aren't showing up. I have the Object declared in my config. Well to clarify, the fields don't show up on my site on my web host (Dreamhost), it works fine only local MAMP stack
-
Re: SS3: updateCMSFields() for Custom Site Config

14 August 2012 at 1:53am
I think you should be using "updateCMSFields" not "updateFormFields".
For anyone else who stumbles upon this thread when trying to find out how to add additional site-wide settings (as I did) then I followed the instructions in the link below and it's working perfectly for me (the additional fields are appearing in the "Settings" area in the CMS):
http://doc.silverstripe.org/framework/en/reference/siteconfig
-
Re: SS3: updateCMSFields() for Custom Site Config

10 September 2012 at 5:47am
The docs site is offline at the moment, so I cant check..
Has the code that goes in the templates to call the siteconfig values changed? These dont seem to be working for me anymore
<h1>$SiteConfig.Welcome1</h1>
<p>$SiteConfig.Welcome2</p> -
Re: SS3: updateCMSFields() for Custom Site Config

12 September 2012 at 3:48am
They have not changed, you still use $SiteConfig.Whatever
-
Re: SS3: updateCMSFields() for Custom Site Config

23 September 2012 at 2:12am
Lol.. schoolboy error. I didn't realise I had commented out a bunch of code. I need to add the SS bundle to TextMate for the highlighting syntax
| 1045 Views | ||
|
Page:
1
|
Go to Top |




