Is there a fluid pendant to the new TS option Feature: #82091 - Allow inline rendering in SVG content object or a workaround? The only solution i see(atm) is to write my own viewhelper or i am missed something?
Asked
Active
Viewed 1,489 times
1 Answers
5
You can define a typoscript object in your root template:
lib.inlineSvg = SVG
lib.inlineSvg {
renderMode = inline
src.field = src
}
(see SVG cObject). Then in your fluid you can do this:
<f:cObject typoscriptObjectPath="lib.inlineSvg" data="{src: 'path/to/the/file.svg'}" />
Of course this limits you to cases in which you have the actual path to the image. You cannot (directly) reference a FAL object. You can, however, just get the files public url:
<f:cObject typoscriptObjectPath="lib.inlineSvg" data="{src: filereference.publicUrl}" />
or
<f:cObject typoscriptObjectPath="lib.inlineSvg" data="{src: filereference.originalResource.publicUrl}" />
depending on whether you are in Extbase cotext or not (see the documentation). You can also pass all other options the cObject takes in the data
argument of the f:cObject
ViewHelper (e.g. width).

Johannes Nielsen
- 157
- 1
- 5