Can we get some instructions on how to install this on Drupal 8? There are instructions for Drupal 7 but nothing for Drupal 8! It's really not the same I dont think because,

  • Getting the enshrined svg sanitizer library from git and manually putting it in the library folder then installing the module through composer did not work (I didnt see any settings for content or media types etc)
  • Installing the library through Composer doesnt work cause it conflicts with the module so you cant install both that way, it's one or the other
  • Also didnt work by installing the module only. Where are the settings?!?!

Comments

Dru Pal created an issue. See original summary.

Dru Pal’s picture

Issue summary: View changes
Dru Pal’s picture

Issue summary: View changes
larowlan’s picture

Priority: Critical » Normal
larowlan’s picture

Status: Active » Fixed

The module provides a formatter - https://git.drupalcode.org/project/svg_sanitizer/blob/8.x-1.x/src/Plugin...

The formatter is available for any file or svg_icon field.

Installation should be achieved by

composer require drupal/svg_sanitizer

larowlan’s picture

I also added these instructions to the project page

Dru Pal’s picture

Status: Fixed » Active

Thanks for your reply and instructions but it still doesnt explain how to configure the module in Drupal 8. And I watched your youtube video which was helpful but I do not see any Format SVG type under "Manage Display". For example if I go to Home >> Administration >> Structure >> Media types (which is in Drupal Core by Default), I dont see an SVG formatter under Manage Display, I have installed 8.x-1.0-alpha1 and it's enabled. Are there no configuration or permission settings? It does not show any link under extend.

larowlan’s picture

What fields are on the media types?

It only works with file and svg_icon fields. I.e it doesn't work with image fields.

Dru Pal’s picture

OK that explains it now. But on the home page of this module it says "It also makes an SVG Sanitizer field formatter available for image and file fields". That's some pretty important change/missing info that should be clearly in the instructions.

larowlan’s picture

Status: Active » Fixed

Ah, thanks - I only worked on the D8 port so haven't really looked closely at the project page.

I clarified that images is D7 only, and added a note about SVG Icon in D8.

In terms of working with Media, we typically add a new media-type called SVG with a file field (or SVG icon) so that we can lock down the permissions.

Even with this module, we don't like giving non-admins access to upload SVG, so having a separate media-type gives us the finer-grained permissions.

larowlan’s picture

Adding issue Credit for @Dru Pal who helped improve module documentation

larowlan’s picture

Title: Instructions o n how to install and configure on Drupal 8? » Instructions on how to install and configure on Drupal 8?
Dru Pal’s picture

Thanks a lot. Hopefully more people learn to use this necessary module when including SVGs on their site.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.