0

I am looking for a way to create a dynamically-generated SVG graphic based on data returned in a view from the Views module. Since Views creates lists and SVG is ultimately XML and therefore DOM-based, they seem perfectly well-suited to work together.

I have seen a few posts around saying that SVG support/integration in Drupal is very limited, and I have only ever seen Javascript used to create an SVG and then manipulate it's DOM. There are some popular javascript libraries already in use, such as Raphaël and svgweb.

Has anyone seen PHP used to do this as well? I have seen the SVG Embed module but it's very new, hasn't been updated since July, and almost nobody is using it.

Does anyone know of a better way to integrate SVG and Drupal Views?

1
  • What type of SVG are you looking to create? I wouldn't say that SVG integration in Drupal is limited; it just depends on the use case. If you want to upload an SVG into an image field, then you're out of luck - and arguably rightly so, as (like you say) an SVG is XML, and not an image.
    – Chapabu
    Commented Sep 1, 2016 at 15:20

1 Answer 1

0

Without knowing your exact use case (I'm assuming you want to just use Views to use the results to build an SVG); it sounds like building a custom Views display style plugin might be in order.

There's a tutorial on Drupal.org (for Drupal 8, but the premise is the same), although I must confess I've only skim read it; and haven't tried implementing it: Building a Views display style plugin for Drupal 8.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.