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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

Adding Logo field to SiteConfig


Go to End


5 Posts   1712 Views

Avatar
hutou

Community Member, 9 Posts

8 October 2013 at 8:09pm

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 http://doc.silverstripe.org/framework/en/reference/siteconfig : 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

Community Member, 9 Posts

12 October 2013 at 9:11am

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

Avatar
zenmonkey

Community Member, 545 Posts

14 October 2013 at 5:42pm

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

Forum Moderator, 267 Posts

6 January 2014 at 9:26am

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

Forum Moderator, 1391 Posts

6 January 2014 at 10:41am

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