Add a token for the site logo

Created on 11 January 2017, over 7 years ago
Updated 16 October 2023, 8 months ago

Problem/Motivation

Spun off from this request for Drupal 7 ( token module ): #823780: Add site logo token , where a token for the logo and logo-url have been proposed. However, since all site:* tokens are in core, I feel this belongs to core as well. Therefore I am proposing it here for Drupal 8.

Proposed resolution

The new tokens are [site:logo] and [site:logo-url] and they provide a rendered image and a local path respectively. In addition to that, both tokens also take a theme parameter ([site:logo:?], [site:logo-url:?]) to fetch a logo for a specific theme.

Steps to reproduce:
- without applying patch, install and enable 'token' module (so you can easily browse the list of available tokens)
- edit Article content type, go to manage fields, edit Body
- click "Browse available tokens" link underneath Help text, to open Available tokens popup
- verify no site logo tokens in the Site information list

- now apply patch
- drush cr
- reload Available tokens popup, verify [site:logo] and [site:logo-url] added
- insert them into help text and create or edit an article to verify the Drupal logo and standard URL (/core/themes/bartik/logo.svg) are now visible
- configure a different logo for another theme (seven)
- insert [site:logo:seven] and [site:logo-url:seven] to have the logo show up.
- [site:logo:non-existing-theme] should not be replaced

Remaining tasks

Review.
Resolve 🐛 FilterHtmlImageSecure filters out valid local svg images Needs work so the default logo's work as well (user uploaded png/jpg files already work).

User interface changes

None.

API changes

None.

Data model changes

None.

Feature request
Status

Needs work

Version

11.0 🔥

Component
Token 

Last updated 3 days ago

No maintainer
Created by

🇳🇱Netherlands Neograph734 Netherlands

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024