我想在Neos中为预告片制作一个内容元素。整个预告片框应链接到Neos或extern内的现有页面。如何在Neos UI后端的右侧面板中定义href链接?
此外,如果我点击预告片框内的元素以在Neos后端进行内联编辑,则不应跳转到该链接。
这是我到目前为止所做的:
Teaserbox.html:
{namespace neos=Neos\Neos\ViewHelpers}
<a href="#" {attributes -> f:format.raw()}>
<neos:contentElement.editable property="title" tag="p" class="medium" />
<neos:contentElement.editable property="text" tag="p" />
<p class="link">
<neos:contentElement.editable property="link" tag="span" />
</p>
</a>
NodeTypes.Teaserbox.yaml:
'Test.Package:Teaserbox':
superTypes:
'Neos.Neos:Content': true
ui:
label: Teaser Box
icon: icon-newspaper
inspector:
groups:
teaser:
label: Teaser Box
properties:
title:
type: string
ui:
label: 'Title Label'
inlineEditable: true
aloha:
placeholder: 'Title'
text:
type: string
ui:
label: 'Text Label'
inlineEditable: true
aloha:
placeholder: 'Text'
link:
type: string
ui:
label: 'Link Label'
inlineEditable: true
aloha:
placeholder: 'Link'
答案 0 :(得分:1)
您需要通过在aloha
媒体资源中添加以下行来启用link
设置中的链接:
'Test.Package:Teaserbox':
...
properties:
...
link:
type: string
ui:
label: 'Link Label'
inlineEditable: true
aloha:
placeholder: 'Link'
link:
'a': true
答案 1 :(得分:0)
显然我走错了路。同时我发现我的请求可以通过Neos的渲染条件轻松解决。现在我有一个不同的代码部分用于后端和前端视图。在预览模式下,我的按钮没有href标签,因此我可以使用内联编辑。
<强> Teaserbox.html 强>
{namespace neos=Neos\Neos\ViewHelpers}
<f:if condition="{neos:rendering.inPreviewMode()}">
<f:then>
<a class="teaser">
</f:then>
<f:else>
<a class="teaser" href="{linkUrl}">
</f:else>
</f:if>
<强> NodeTypes.Teaserbox.yaml:强>
'Test.Package:Teaserbox':
superTypes:
'Neos.Neos:Content': true
ui:
label: Teaser Box
icon: icon-newspaper
inspector:
groups:
teaser:
label: Teaser Box
properties:
linkUrl:
type: string
defaultValue: '#'
ui:
label: 'URL'
reloadIfChanged: true
inspector:
group: ziehli
editor: 'Neos.Neos/Inspector/Editors/LinkEditor'
这里有关于它的文件:http://neos.readthedocs.io/en/stable/References/ViewHelpers/Neos.html