当尝试在类型链接上添加带有HTML元素的data-*属性时,解析htmlspecialchars中的某些内容将包含整个链接。
起初,我认为COA是问题所在(这似乎很奇怪,因为代码直到现在为止都起作用了),于是我转而使用文本元素,甚至撕毁了所有的包装,以便试图控制以何种方式呈现的内容,但没有任何用处。我也试图用FLUIDTEMPLATE替换它,但是它没有改变什么。
与COA
lib.contentElement.settings.media.popup.linkParams.ATagParams.postCObject = COA
lib.contentElement.settings.media.popup.linkParams.ATagParams.postCObject {
10 = TEXT
10 {
field = uid
noTrimWrap = | data-gallery="ce|" data-toggle="lightbox"|
}
20 = COA
20 {
stdWrap.noTrimWrap = | data-footer="|"|
10 = TEXT
10 {
data = file:current:publicUrl
wrap = <a class='downloadlink' href='|' target='_blank'>Download</a>
if.isFalse.field = tx_emboss_lightbox_hidedownload
if.isTrue.data = file:current:publicUrl
}
20 = TEXT
20 {
data = file:current:description
wrap = <p class='caption'>|</p>
if.isFalse.field = tx_emboss_lightbox_hidecaption
if.isTrue.data = file:current:description
}
30 = TEXT
30 {
data = file:current:creator
wrap = <p class='author'>|</p>
if.isFalse.field = tx_emboss_lightbox_hideauthor
if.isTrue.data = file:current:creator
}
}
30 = TEXT
30 {
data = file:current:title
noTrimWrap = | data-title="|"|
if.isTrue >
if.isTrue.data = file:current:title
if.isFalse.field = tx_emboss_lightbox_hidetitle
}
40 = TEXT
40 {
value = true
noTrimWrap = | data-showcount="|"|
if.isFalse.field = tx_emboss_lightbox_hideimagecount
}
}无COA
lib.contentElement.settings.media.popup.linkParams.ATagParams.postCObject {
10 = TEXT
10 {
field = uid
noTrimWrap = | data-gallery="ce|" data-toggle="lightbox" |
}
11 = TEXT
11.value = data-footer="
12 = TEXT
12 {
data = file:current:publicUrl
wrap = <a class='downloadlink' href='|' target='_blank'>Download</a>
if.isFalse.field = tx_emboss_lightbox_hidedownload
if.isTrue.data = file:current:publicUrl
}
13 = TEXT
13 {
data = file:current:description
wrap = <p class='caption'>|</p>
if.isFalse.field = tx_emboss_lightbox_hidecaption
if.isTrue.data = file:current:description
}
14 = TEXT
14 {
data = file:current:creator
wrap = <p class='author'>|</p>
if.isFalse.field = tx_emboss_lightbox_hideauthor
if.isTrue.data = file:current:creator
}
15 = TEXT
15.value = "
30 = TEXT
30 {
data = file:current:title
noTrimWrap = | data-title="|"|
if.isTrue >
if.isTrue.data = file:current:title
if.isFalse.field = tx_emboss_lightbox_hidetitle
}
40 = TEXT
40 {
value = true
noTrimWrap = | data-showcount="|"|
if.isFalse.field = tx_emboss_lightbox_hideimagecount
}
}与FLUIDTEMPLATE
lib.contentElement.settings.media.popup.linkParams.ATagParams.postCObject = FLUIDTEMPLATE
lib.contentElement.settings.media.popup.linkParams.ATagParams.postCObject {
file = EXT:emboss_lightbox/Resources/Private/Standalone/GalleryImage.html
dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
dataProcessing.10 {
# the field name where relations are set
# + stdWrap
files.data = file:current:uid
# The target variable to be handed to the ContentObject again, can be used
# in Fluid e.g. to iterate over the objects. defaults to "files" when not defined
# + stdWrap
as = images
}
}流体
<f:spaceless>data-gallery="ce{field:uid}" data-toggle="lightbox" data-footer="<f:if condition="{data.tx_emboss_lightbox_hidedownload} != true"><f:if condition="{images.0.publicUrl}"><a href='{images.0.publicUrl}' target='_blank'>Download</a></f:if></f:if><f:if condition="{data.tx_emboss_lightbox_hidecaption} != true"><f:if condition="{images.0.description}"><p class='caption'>{images.0.description}</p></f:if></f:if><f:if condition="{data.tx_emboss_lightbox_hideauthor} != true"><f:if condition="{images.0.creator}"><p class='author'>{images.0.creator}</p></f:if></f:if>" data-title="{images.0.title}" data-showcount="true"</f:spaceless>Fluid(readable)这个版本让我很不爽,因为我所有的新行都变成了<p>&nbps;</p>
<f:spaceless>
data-gallery="ce{field:uid}" data-toggle="lightbox" data-footer="
<f:if condition="{data.tx_emboss_lightbox_hidedownload} != true">
<f:if condition="{images.0.publicUrl}">
<a href='{images.0.publicUrl}' target='_blank'>Download</a>
</f:if>
</f:if>
<f:if condition="{data.tx_emboss_lightbox_hidecaption} != true">
<f:if condition="{images.0.description}">
<p class='caption'>{images.0.description}</p>
</f:if>
</f:if>
<f:if condition="{data.tx_emboss_lightbox_hideauthor} != true">
<f:if condition="{images.0.creator}">
<p class='author'>{images.0.creator}</p>
</f:if>
</f:if>" data-title="{images.0.title}" data-showcount="true"</f:spaceless>预期的输出如下所示:
<a href="link to image" title="image title" data-gallery="cexyz" data-toggle="lightbox" data-footer="<a href='path to publicUrl'>Download</a><p class='caption'>Some description with possible html in it too</p><p class='author'>Some author</p>" data-title="image title" data-showcount="true"><img src="Someimage.jpg"></a>相反,我得到了这个:
<a href="link to image" title="image title" data-gallery="cexyz" data-toggle="lightbox" data-footer="<a href='path to publicUrl'>Download</a><p class='caption'>Some description with possible html in it too</p><p class='author'>Some author</p>" data-title="image title" data-showcount="true"><img src="Someimage.jpg"></a>发布于 2019-08-09 05:19:52
正如您在结尾所显示的,您的问题不是数据属性,而是整个链接。该部分没有包含您的代码。我想你只需要一个<f:format.raw>标签围绕你的链接。
也许连整个CE都受到了影响,而且您还没有注意到,因为文本中没有其他特殊字符。
https://stackoverflow.com/questions/57412152
复制相似问题