Jump to:

23370 Posts in 18160 Topics by 2864 members

General Questions

SilverStripe Forums » General Questions » Adding Logo field to SiteConfig

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

Page: 1
Go to End
Author Topic: 483 Views
  • hutou
    Avatar
    Community Member
    6 Posts

    Adding Logo field to SiteConfig Link to this post

    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

  • hutou
    Avatar
    Community Member
    6 Posts

    Re: Adding Logo field to SiteConfig Link to this post

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

  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: Adding Logo field to SiteConfig Link to this post

    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

  • camfindlay
    Avatar
    Forum Moderator
    148 Posts

    Re: Adding Logo field to SiteConfig Link to this post

    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.

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Adding Logo field to SiteConfig Link to this post

    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

    483 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.