[英]Typo3 Neos: How to pass parameter from typoscript using 'TYPO3.Neos:Plugin'?
[英]Neos CMS NodeTypes: How to make href link editable in UI
我想在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'
您需要通过在link
属性中添加以下行来启用aloha
设置中的link
:
'Test.Package:Teaserbox':
...
properties:
...
link:
type: string
ui:
label: 'Link Label'
inlineEditable: true
aloha:
placeholder: 'Link'
link:
'a': true
显然我走错了路。 同时我发现,使用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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.