Loading children of a Node

Hello there,
I’m new to neos and unable to load a child node of my node. In this case, the child node is a Neos.Neos:ContentCollection. In the final component where I want to display the collection, it’s not available.

Where I’m currently at:

I have a Document Node called Event. The event node has a childNode which is called main and type ContentCollection.

'Page.Site:Document.Event':
  superTypes:
    'Neos.Neos:Document': true
    'Neos.Neos:Content': true
    'Page.Site:Mixin.InspectorGeneral': true
    'Page.Site:Mixin.Image': true
  ui:
    label: 'Event'
    group: event
    icon: 'file-alt'
    inspector:
      groups:
        page:
          label: 'Event'
        moreinfo:
          label: 'More Info'
  childNodes:
    'main':
      type: 'Neos.Neos:ContentCollection'
  properties:
     ..........

To display a list of my events, I have a Content Element which loads the Events.
In the content element I loop with a Fusion Loop through the list and pass the event to a EventItem Component.

prototype(Page.Site:Content.EventList) < prototype(Neos.Neos:ContentComponent) {
    
    events = ${q(site).find('[instanceof Page.Site:Document.Event]')}

    renderer = afx`
        <div class="events">
            <Neos.Fusion:Loop items={props.events} itemName="event" iterationName="itemIterator">
                <Page.Site:Content.EventItem  event={event}></Page.Site:Content.EventItem>
            </Neos.Fusion:Loop>
        </div>
    `
}

In the EventItem component I try to get the ContentCollection from the event node. But there is the problem. I can’t.

prototype(Page.Site:Content.EventItem) < prototype(Neos.Neos:ContentComponent) {

    myContent = Neos.Neos:ContentCollection {
        nodePath = ${q(node).property('event').children('[instanceof Neos.Neos:ContentCollection]').get(0).path}
    }

    renderer = afx`
        <div>
            { props.myContent  }
        </div>
    `
}

What am I missing here?

Idk about this ^^ seems illegal xD - dont know if this is legit - but thinking about it it doesnt make sense - either its a page or a content element.


hehe i see what you did here - no need for the complex “.path” / it wont work since the path must be relative to the current node

    myContent = Neos.Neos:ContentCollection {
        nodePath = ${q(node).property('event').children('[instanceof Neos.Neos:ContentCollection]').get(0).path}
    }

if you have the node content collection at hand you can just put it in there:

    myContent = Neos.Neos:ContentCollection {
        # You may override this to get your content collection from a different place than the current node.
        @context.node = ${q(node).property('event').children('[instanceof Neos.Neos:ContentCollection]').get(0)}
    }

Hey, thanks for your answer. Poorly that did not work…

Solved it differently:

    event = ${q(node).property('event')}
    @context.node = ${event}

    main = Neos.Neos:ContentCollection {
        nodePath = 'main'
    }

hmm odd,

nice that you found anothet way, but you could also try

${q(node).property(‘event’).find(‘main’).get(0)}