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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Adding Logo field to SiteConfig


Reply

5 Posts   542 Views

Avatar
hutou

8 October 2013 at 8:09pm Community Member, 6 Posts

Hi,
I am trying to add a Logo image field to SiteCOnfig under SS 3.1. I first followed the instructions on extending SiteConfig at [url]http://doc.silverstripe.org/framework/en/reference/siteconfig[/url] : everything went Ok.
I then changed the lines

private static $db = array(
'FooterContent' => 'HTMLText'
);
public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab("Root.Main", new HTMLEditorField("FooterContent", "Footer Content"));
}


to

private static $has_one = array(
'LogoImage' => 'Image',      
);
public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab(
"Root.Main", new UploadField("LogoImage", "Choose an image for your site logo"));
}

but it doesn't work. I can select a file for download (no drag and drop area however), but on validating, the screen is not updated to reflect my choice, and while, on saving, a message tells me "saving is Ok, nothing at all is uploaded.

This worked perfectly in SS 3.05.
Thanks for help

Avatar
hutou

12 October 2013 at 9:11am Community Member, 6 Posts

After upgrade to SS 3.1.1, problem still pending ...
Any idea ?

Avatar
zenmonkey

14 October 2013 at 5:42pm Community Member, 528 Posts

Curious, I have Image realtions on SiteConfig extension working fine on a few sites. The fact that field is rendering correctly may be the problem

Avatar
camfindlay

6 January 2014 at 9:26am Forum Moderator, 149 Posts

Just tested your code on a complete fresh copy of the latest stable version (3.1.2), seems to all work perfectly.

Make sure you have run a dev/build (either in the browser http://localhost/dev/build/ or via command line) to ensure the database actually has the column in the DB to save the Image relationship.

Avatar
martimiz

6 January 2014 at 10:41am Forum Moderator, 1095 Posts

I would like to point to this post.

http://www.silverstripe.org/customising-the-cms/show/21490

I don't know if it has anything to do with your problem, but there seems to be a (FireFox) issue with 'UploadField -> from your computer' after a CMS reload...

Martine