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.

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   2587 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