stefkey
(Stefan Johänntgen)
June 13, 2016, 11:15am
1
Hi,
how can I add a editable content in the MainMenu.html?
I try to add {menuContent -> f:format.raw()} in the MainMenu.html but it don’t work.
(menuContent is my special node for this)
It’s that possible with neos?
Thanks a lot for your support.
christianm
(Christian Müller)
June 13, 2016, 11:17am
2
You can definitely do that, but I guess I need a bit more context about your TypoScript, the Menu and this “menuContent”.
stefkey
(Stefan Johänntgen)
June 13, 2016, 11:49am
3
okay, as basic for my first neos-site I use the Neos-Demo Page.
the menuContent is a new ContentCollection like the footer in the demopage, but I don’t know that is the right way for this?
Is it necessary the menuContent define as “part” in the Roots.ts2?
I think I will try this now.
Or is there another way to geht an editable area (node) in my megamenu?
stefkey
(Stefan Johänntgen)
June 19, 2016, 9:48am
4
I try my best, but i don’t found solution without your help.
My problem: I would like to show a editable content in the menu.
I have 4 items in the first level. Mouseover open the sublist with subitems. Now I would like add an editable text content in these big sublist, because it have many space. For every first level content a own text content.
Do I need a shared ContentCollection (like the footer in the NeosDemoSite for they issue?
Here my last try, it don’t work:
MainMenu.html
{namespace neos=TYPO3\Neos\ViewHelpers}
{namespace media=TYPO3\Media\ViewHelpers}
<f:render section="itemList" arguments="{items: items, site: site}" />
<f:section name="itemList">
<nav class="navbar navbar-static-top navbar-default first-level-navigation" role="navigation">
<div class="collapse navbar-collapse navbar-main-collapse">
<ul class="nav nav-pills mainNav">
<f:for each="{items}" as="item" iteration="menuItemIterator">
<li class="firstLevel {item.state} m{item.node.identifier}" id="{item.node.identifier}">
<f:if condition="{item.subItems}">
<f:then>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{item.label}</a>
<f:render section="subList" arguments="{items: item.subItems}"/>
</f:then>
<f:else>
<neos:link.node node="{item.node}">{item.label}</neos:link.node>
</f:else>
</f:if>
</li>
</f:for>
</ul>
</div>
</nav>
</f:section>
<f:section name="subList">
<div class="sj-menu-wrapper">
<ul class="second-level-sub-navigation nav">
<f:for each="{items}" as="item">
<li class="{item.state}" id="{item.node.identifier}">
<f:if condition="{item.subItems}">
<f:then>
<div class="navTitle">{item.label}</div>
<f:render section="subSubList" arguments="{items: item.subItems}"/>
</f:then>
<f:else>
<neos:link.node node="{item.node}">{item.label}</neos:link.node>
</f:else>
</f:if>
</li>
</f:for>
</ul>
<div class="sj-additionalContent">
<p>Hier nun den additionalContent hinpacken</p>
{neos:contentElement.editable(property: 'text', tag: 'p')}
</div>
</f:section>
Roots.ts2
##
# Create shorthand namespace for our site package name.
# It is available in all included typoscript files.
#
namespace: Site=WS.fshsite
include: NodeTypes/*
/**
* Root TypoScript template for the Neos demo website
*/
page = Page {
head {
stylesheets {
site = TYPO3.TypoScript:Template {
templatePath = 'resource://WS.fshsite/Private/Templates/Page/Default.html'
sectionName = 'stylesheets'
node = ${node}
}
}
metadata = TYPO3.TypoScript:Template {
templatePath = 'resource://WS.fshsite/Private/Templates/Page/Default.html'
sectionName = 'metadata'
}
}
// This query checks if the second level menu has items and sets an additional class for the body
bodyTag.attributes.class = ${q(node).parents().count() >= 1 && q(node).children('[instanceof TYPO3.Neos:Document]').filter('[_hiddenInIndex=false]').count() > 0 ? 'has-subpages' : ''}
body {
templatePath = 'resource://WS.fshsite/Private/Templates/Page/Default.html'
sectionName = 'body'
imageUri = TYPO3.Neos:ImageUri {
asset = ${q(node).property('image')}
maximumWidth = 2560
maximumHeight = 1280
@if.image = ${q(node).property('image')}
}
imageTitleText = ${q(node).property('imageTitleText')}
parts {
mainMenu = Menu {
entryLevel = 1
templatePath = 'resource://WS.fshsite/Private/Templates/TypoScriptObjects/MainMenu.html'
maximumLevels = 4
}
secondLevelMenu = Menu {
entryLevel = 2
templatePath = 'resource://WS.fshsite/Private/Templates/TypoScriptObjects/SecondLevelMenu.html'
maximumLevels = 1
}
}
content {
// Default content section
main = PrimaryContent {
nodePath = 'main'
}
}
// A sharedContent
sharedContent = ContentCollection {
nodePath = ${q(site).children('sharedContent').property('_path')}
collection = ${q(site).children('sharedContent').children()}
}
javascripts.site = TYPO3.TypoScript:Template {
templatePath = 'resource://WS.fshsite/Private/Templates/Page/Default.html'
sectionName = 'bodyScripts'
}
}
}
default < page
prototype(WS:MainMenu) < prototype(TYPO3.Neos:Content) {
templatePath = 'resource://WS.fshsite/Private/Templates/TypoScriptObjects/MainMenu.html'
text = ${q(node).property('text')}
}
NodeType.yaml
##
# SJ MainMenu Content
#
#
'WS:MainMenu':
superTypes:
'TYPO3.Neos:Content': TRUE
ui:
label: 'MainMenu'
group: 'general'
inspector:
groups:
image:
label: 'Image'
icon: 'icon-image'
position: 1
properties:
text:
type: string
defaultValue: 'Ihr Text'
ui:
label: 'Text'
reloadIfChanged: TRUE