Hi!

I would like to add a second logo to a website through the theme interface (admin/appearance/settings/MY-THEME).

I found this solution: https://www.drupal.org/node/177868 post by WilliamB. But he states that there are cleaner ways to do it and as far as I can tell this code leads to database entries for the 2nd logo that aren't used and don't get deleted (if I upload a new logo and look at the {file_managed} table the old logo is still there with a status of permanent).

Isn't it better to copy the default logo functionality (tried to find how to do this but was not able to find anything)?

Any help would be much appreciated!

Jasper

Comments

Anks’s picture

Hello Jasper,

Please find below link

http://drupal.stackexchange.com/questions/54807/how-to-use-images-in-the...

Hope this will help you.

Thanks.

Ankit Hinglajia

jazzper’s picture

Hi Ankit,

Thanks for your reply.

Let me start with saying that I have a basic understanding of PHP (I am in the process of learning theme related PHP by implementing a HTML, CSS & JS website into Drupal) so I might miss things in the code. Anyway I looked at the link you posted and at the links inside this post but I don't think there is any code that removes the old file.

Maybe a way to do it would be to set the status of the old file from permanent to temporary before uploading a new file?

But wouldn't it be better to copy the core logo functionality?

Anyway for now I will upload a second logo through an image field on a content type. In this way I know for sure my database stays clean and the files are submitted in the wright way. I am still interested in a solution though as I am planning to solve this after I finished the website I am working on now.

Jasper

Anks’s picture

Hello Jasper,

Its nice that you are learning Drupal.

Content type will also create some more tables in database. So it will be not nice , that you are creating a content type only for one logo.

For easy way, you can just create simple block with Logo Image & place that block to particular place where you want to show another Logo.

And yes if you want to learn , how to create image upload functionality with the theme settings.

Please find this link - http://ghosty.co.uk/2014/03/managed-file-upload-in-drupal-theme-settings/

It will give you more detail idea. You just need to have basic idea about Form API.

Good luck.

Ankit Hinglajia

jazzper’s picture

Thanks for the link, I found this one already and it looks like a good place to start:)