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
    Sep 1 '16 at 15:20
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, privacy policy and cookie policy

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