Hey Guys,
I have a Website, were I want to have a Picture in every document.
The picture should be in the header area.
I thought it would be o good idea to create a childNode for the document but I have no idea how to render it. If i am right the fusion file of the headerImg is not the right spot in this case.
I have the Page like that:
'WG.Site:Document.AbstractPage':
abstract: true
superTypes:
'Neos.Neos:Document': true
childNodes:
headerimg:
type: 'WG.Site:Content.ImageHeader'
main:
type: 'Neos.Neos:ContentCollection'
constraints:
nodeTypes:
'WG.Site:Constraint.Content.Restricted': false
constraints:
nodeTypes:
'WG.Site:Document.HomePage': false
'WG.Site:Constraint.Document.Restricted': false
And I can add the Img in the backend, but its not rendert in the document itself.
This is the imgHeader
'WG.Site:Content.ImageHeader':
superTypes:
'Neos.Neos:Content': true
'WG.Site:Mixin.Image': true
ui:
label: Header-Bild
icon: icon-picture
position: 300
and this is the fusion of the ImageHeader
/**
* This code is feasable for production, and renders an image with LazyBones.
*
* To better learn Neos take a look at WG.Site:Content.BasicImage,
* which renders our images as an img tag.
*/
prototype(WG.Site:Content.ImageHeader) < prototype(Neos.Neos:ContentComponent) {
# if the current node has previous siblings it is not the
# first content and should be loaded lazy otherwise not
lazy = ${q(node).prev().is()}
src = Neos.Fusion:Case {
image {
condition = ${q(node).property('image') ? true : false}
renderer = Sitegeist.Kaleidoscope:AssetImageSource {
asset = ${q(node).property('image')}
}
}
dummyImage {
condition = ${site.context.inBackend}
renderer = Sitegeist.Kaleidoscope:DummyImageSource
}
}
alternativeText = ${q(node).property('alternativeText')}
renderer = afx`
<Sitegeist.Lazybones:Image
class="container-image header-image"
lazy={true}
lazyWidth={200}
imageSource={props.src}
srcset="320w, 400w, 480w, 600w, 640w, 720w, 768w, 800w, 960w, 1024px, 1280w, 1440w, 1600w, 1680w, 1920w, 2560w"
sizes={props.sizes}
alt={props.alternativeText}
/>
`
}
In best case I would like to render it in the Header.fusion
prototype(WG.Site:Component.Header) < prototype(Neos.Fusion:Component) {
homeLink = Neos.Neos:NodeUri {
node = ${site}
}
menuItems = Neos.Neos:MenuItems {
startingPoint = ${site}
maximumLevels = 3
}
includeLogo = Neos.Fusion:Tag {
tagName = 'img'
attributes {
src = Neos.Fusion:ResourceUri {
path = 'resource://WG.Site/Public/Frontend/images/logo.png'
}
}
}
renderer = afx`
<div clasS="header-bg">
<header class="main-header grid-container">
<WG.Site:Component.Header.MenuItemsRenderer items={props.menuItems} />
<a class="logo page-logo" href={props.homeLink}>
{props.includeLogo}
</a>
</header>
</div>
`
@cache {
mode = 'cached'
entryIdentifier {
documentNode = ${documentNode}
}
entryTags {
1 = ${Neos.Caching.nodeTypeTag('Neos.Neos:Document', documentNode)}
}
}
}