Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Twig SVG

Security covered Drupal 8–10 · not 11

Part of the Twig ecosystem · 26 projects

View on drupal.org

This module adds a simple method to include inline SVGs in twig templates.

To configure:
1. Ensure your combined SVG file is in your default theme /images/ folder - I'd recommend using Gulp to do this. @see

https://www.npmjs.com/package/gulp-cheerio
https://www.npmjs.com/package/gulp-svgstore
https://www.npmjs.com/package/gulp-svgstore#transform-svg-sources-or-com...

2. Optionally, configure svg file paths via /admin/config/twig_svg/config
3. Enable the Twig SVG module
4. To include an SVG icon in a twig template, add the following in the relevant
html.twig file:

{{ icon('icon-name', 'Icon title') }}

Optionally, to add a title, classes, and additional attributes:
{{ icon('icon-name', 'Icon title', ['extra-class', 'another-class'], {'name-one': 'value-one', 'name-two': 'value-two'}) }}

Optionally, to add a title, classes, additional attributes and wrapper classes:
{{ icon('icon-name', 'Icon title', ['extra-class', 'another-class'], {'name-one': 'value-one', 'name-two': 'value-two'}, ['wrapper-class-1', 'wrapper-class-2']) }}

Credit to https://www.lullabot.com/articles/better-svg-sprite-reuse-in-drupal-8 for the fundamentals of this.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
9
Tracked since
May 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
8.x-1.10 Stable 8–10 Sep 13, 2024
2.0.0-alpha2 Pre-release 10–11 Sep 13, 2024
8.x-1.9 Stable Aug 16, 2024
8.x-1.8 Stable Aug 16, 2024
8.x-1.7 Stable Aug 16, 2024
8.x-1.6 Stable Aug 16, 2024
2.0.x-dev Dev Aug 16, 2024
2.0.0-alpha1 Pre-release Aug 16, 2024
8.x-1.5 Stable May 10, 2023