Needs work
Project:
Token
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Jun 2010 at 12:13 UTC
Updated:
10 Aug 2022 at 15:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
muximus commentedwould be nice
Comment #2
bensnyder commented+1 for a logo token!
Thanks :)
Comment #3
dave reidComment #4
docans commentedI also agree very much
Comment #5
bojanz commentedCommerce Kickstart v2 does this:
might help someone with rolling the patch, or solving an immediate need.
Comment #6
lsolesen commentedRemember
Comment #7
damienmckennaClosed a duplicate: #2059531: Add a token to output the site's logo
BTW Ubercart (yes!) has a token for this already.
Comment #8
raulmuroc commentedThis is really a nice feature. In my sparece time will try to fix it :)
Comment #9
damienmckenna@RaulMuroc: Nobody has put the time into building a patch for it, that's why it hasn't been fixed yet.
If you had an hour-or-two to spare you could build a patch and upload it for us to review? *nudge* *nudge* :-)
Comment #10
yvesvanlaer commentedHello
I created a small module which add a logo token. Really weird that it wasn't just there.
Comment #11
damienmckennaComment #12
raulmuroc commentedPerhaps is better to have it as a module
https://www.drupal.org/sandbox/raulmuroc/2335571
Comment #13
kaareNo, this should not be hidden away in a tiny module. It's a fundamental part of the [site:] namespace and belongs in the token module. I was flabbergasted when I did not find it in the token browser while adding Meta tags to my site :-)
Comment #14
adamps commentedIs there a consensus on exactly what the token should do?
Potentially both are useful. New code here should be compatible with existing code. So site:logo could output the themed image and site:logo-url could return the URL (with options for site:logo-url:path etc).
I agree with @kaare this is better in the token module than a separate one or a sub-module. Hopefully one of us will find time to make a patch soon.
Comment #15
adamps commentedOK, I give in:-) Here is a patch. I think it will work on both dev and the stable release.
It is based on Ubercart which implemented site:logo (commerce uses a module-specific name) and also handles the logo missing case.
I have added site:logo-url (with chaining). This is useful for example when building a URL that links back to the logo (e.g. a Pinterest share button http://pinterest.com/pin/create/button/?url=[site:url]&media=[site:logo-...)
Comment #16
kopeboyPlease can we have this!?
I was so surprised [site:logo] didn't exist already :(
Comment #17
chegor commented+1 for commiting this.
Comment #18
adamps commented@chegor @kopeboy Thanks for the vote in favour. Next step is for someone to set status to "reviewed and tested by the community". If you have reviewed and/or tested, please update the status, thanks.
Comment #19
alexverb commentedI'm going to test this patch right away. But since #15 gave me whitespace warnings I've removed those in this patch first.
Comment #20
alexverb commentedThe patch works for me. I've done the following steps:
https://simplytest.me/project/token/7.x-1.x?patch[]=https://www.drupal.o...
The following is the result:

Comment #21
catFighter commented#19 works very good. In Drupal Commer from #5 i #6 doesn't work becasue generate array notice and logo doesn't show. But #19 will be helpfull!!
Comment #22
nickonom commented#19 also worked for me. There are two new tokens after applying the patch: [site:logo] and [site:logo-url]
RTBC
Comment #23
maxplus commentedGreat,
#19 is working for me, using it in a Message type
Comment #24
kopeboyPlease include this!
Comment #25
neograph734Since I figured all
site:*tokens are defined in Drupal core (system.tokens.inc), I figured it made more sense to implement this feature in Drupal core.So I have just proposed this to Drupal 8: #2842780: Add a token for the site logo and added the needs backport flag to get it into D7. IMHO that would be a better place for it.
(I am not associated to this module whatsoever, so one of the maintainers may prove me wrong :) )
Comment #26
delacosta456 commentedHi .. #19 is Working for me to0 on PHP 5.5 + Mysql 5.5 D7 ....
Also worked in Page Manager and Panel
thanks
Comment #27
vasikei also confirm that #19 patch works
Comment #28
neograph734It might not...
As explained in #25, I have performed a direct port of this patch for Drupal 8. The feedback alexpott gave me there was that there was not enough control over what logo will be selected. (In cases where you configure the Bartik logo, but send a mail from the admin interface, etc.) See #2842780-17: Add a token for the site logo.
The same applies to this patch, it just takes the logo from the current theme, which might cause unexpected behavior.
UPDATE
I have attempted to overcome the issue by providing a theme parameter (
[site:logo:?],[site:logo-url:?]) to fetch a logo for a specific theme and having[site:logo]and[site:logo-url]always return the logo of the default theme.Comment #29
jjmackow commentedA workaround solution for this problem is to use the 'Block Token' module along with the Logo Block module.
The logo block module gives you the ability to apply image styles to the logo itself, and then with the Block Token module enabled, you'll find a checkbox within the Logo Block configuration page that allows you to create a token for that specific block.
Comment #30
stefank commentedCan confirm that patch #19 still works on D7 with PHP7.1 and in rules email.
Comment #31
anybodyWould be nice if the syntax from the Drupal 9 issue could be transfered / backported over here to be the same?