6

In SilverStripe 3.1 is it possible to overwrite the SilverStripe logo and the url (instead of replacing it) which is shown on top of the CMS on the left side?

3dgoo
  • 15,716
  • 6
  • 46
  • 58
Steve
  • 1,036
  • 2
  • 13
  • 31

4 Answers4

10

In SilverStripe 3.1 we can overide the logo by using some custom css.

First we tell LeftAndMain to include an extra css file by adding this to our config.yml:

LeftAndMain:
  extra_requirements_css:
    - mysite/css/leftandmainextracss.css

Then in our leftandmainextracss.css file we can edit the default logo css to load whatever image we want:

.cms-logo a {
    background: url("../images/new-branding-cms-logo.png") no-repeat left center;
}

We can set the url and title in our config.yml:

LeftAndMain:
  application_link: 'http://www.example.com'
  application_name: 'Example'
  extra_requirements_css:
    - mysite/css/leftandmainextracss.css

There are some details on extending the cms interface here: https://docs.silverstripe.org/en/3.1/developer_guides/customising_the_admin_interface/how_tos/extend_cms_interface/

There is also this module to change the CMS branding. I have not tested this: https://github.com/skorp/Silverstripe--CMSbranding

3dgoo
  • 15,716
  • 6
  • 46
  • 58
  • 1
    The : needs to be removed after the css file name. mysite/css/leftandmainextracss.css – Gavin Bruce Sep 30 '14 at 02:00
  • You are right @GavinBruce. Thank you for pointing out that bug. I have fixed that up now. – 3dgoo Sep 30 '14 at 04:15
  • 1
    Just to add on to this, you can also set application_link. He did ask about this as well. – drye Nov 03 '14 at 23:25
  • Thanks @drye I missed that in the question. I have added details on how to change the `application_link` and `application_name` as you have suggested. – 3dgoo Nov 04 '14 at 00:42
1

I've found that I had to make one change to the above solution. When declaring the extra_requirements_css in config.yml I had to do it this way:

LeftAndMain:
  extra_requirements_css: [mysite/css/leftandmainextracss.css]
muskie9
  • 476
  • 2
  • 5
1

For SilverStripe 4 it has to be with namespaces:

SilverStripe\Admin\LeftAndMain:
  extra_requirements_css:
    - mysite/css/leftandmainextracss.css
ivoba
  • 5,780
  • 5
  • 48
  • 55
0

I found that for silverstripe 4.2 the namespace wasn't enough - the directory also needs to be exposed ie. made available at ~/resources/mysite/css/ so i just moved it into my theme.

mikeyc7m
  • 73
  • 7