Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

SVG Embed

323 sites Security covered Drupal 10–11
View on drupal.org

This module provides a text filter that automatically embeds and translates SVG graphics within your content. It supports referencing SVGs by file ID or filename, and can also translate embedded file or media entities if they are SVGs. The module also includes functionality to manage translations for text within SVG files.

SVG graphics are really powerful but not yet widely supported. What makes them interesting in particular is that included text remains text and therefore should have some positive SEO effect and is searchable.

What this module does is to provide a text filter that automatically embeds an SVG graphic into your html text and before doing this, translates all the textstrings in the graphic. This has huge advantages on multi lingual sites: the graphic always adjusts to the surounding content or the user preferences and gets displayed in the correct language.

How does it work? The module asumes that you upload your SVG graphics in any of the multiple ways that Drupal supports. In other words, the file should be on your server and a record of the file should be in the managed files table. You can then simply include something like [svg:4711] into your body text of any node, assuming that 4711 is the file id in your database. If you don't know the file id, you can also use something like [svg:my_graphic.svg] where my_graphic.svg is the filename that has been uploaded.

New since version 2.1: This version now also supports the replacement of embedded file entities and embedded media entities if those are SVG files. So there's the list of supported syntax, that this text filter can replace with the translated SVG file content:

  • [svg:FILEID]
  • [svg:FILENAME]
  • <svg data-entity-type="file" data-entity-uuid="UUID"> </svg>
  • <drupal-media data-entity-type="media" data-entity-uuid="UUID"> </drupal-media>

That's all - it just works that way. And translates your SVG graphic on-the-fly too.

How to setup your site for SVG Embed? There are just a few steps: Enable the module, then configure your text formats (go to admin/config/content/formats) and enable svg_embed for any text format where you want to use it. To be safe that no other filter plays with your SVG code later you should make the SVG Embed filter the last one in the sequence of filters.

How do you translate your text in SVG files? The module assumes that your SVG graphics come with english text included in the original image. Once you've included them into your site, they show up in english only by default until you go through the translation of the strings. To do that, go to "Translate interface" > "Embedded SVG" (found at admin/config/regional/translate/svgextract) and you can download PO files for every enabled language on your site. Once you've completed the translation offline, you can upload the translated files in the same form. Note: All strings from all SVG files on your site will be found in one single PO file per language.

Dependencies: Only two core modules, locale and filter, are required by svg_embed.

Known issues:

  • Embedding SVG inline into XHTML seems to work really well with Firefox and IE (yes, IE is on the positive site this time), but text doesn't properly display in Chrome and Safari. We haven't found the reason for that yet but it does seem to be a browser issue.

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
3
Tracked since
Oct 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 3
Maintenance
Slowing

Release Timeline

Releases

Version Type Core Release date
2.1.3 Stable 10–11 Aug 29, 2025
7.x-1.3 Stable Oct 23, 2024
2.1.2 Stable 10–11 Oct 23, 2024