【问题标题】:TYPO3 (Fluid): Generate FAL-SVG-Image as inline codeTYPO3 (Fluid):将 FAL-SVG-Image 生成为内联代码
【发布时间】:2021-07-22 03:02:07
【问题描述】:

新的 TS 选项 Feature: #82091 - Allow inline rendering in SVG content object 是否有流体吊坠或解决方法? 我看到的唯一解决方案(atm)是编写我自己的 viewhelper 或者我错过了什么?

【问题讨论】:

标签: typo3 fluid


【解决方案1】:

您可以在根模板中定义一个打字稿对象:

lib.inlineSvg = SVG
lib.inlineSvg {
  renderMode = inline
  src.field = src
}

(请参阅SVG cObject)。然后在你的流体中你可以这样做:

<f:cObject typoscriptObjectPath="lib.inlineSvg" data="{src: 'path/to/the/file.svg'}" />

当然,这会将您限制在您拥有图像的实际路径的情况下。您不能(直接)引用 FAL 对象。但是,您可以只获取文件的公共 url:

<f:cObject typoscriptObjectPath="lib.inlineSvg" data="{src: filereference.publicUrl}" />

<f:cObject typoscriptObjectPath="lib.inlineSvg" data="{src: filereference.originalResource.publicUrl}" />

取决于您是否在 Extbase cotext 中(请参阅the documentation)。您还可以在 f:cObject ViewHelper 的 data 参数中传递 cObject 采用的所有其他选项(例如宽度)。

【讨论】:

  • 完美运行。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-12-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-03
相关资源
最近更新 更多