I’m a total Neos Noob, so the following might sound very basic to you.
I’m facing a challenge where I need to have a number of items in a contentCollection to be wrapped in custom markup. I need this in order to build carousels that accept existing domain specific node types as children. I read about the basic carousel ind the docs and also about Flowpack.Listable but both don’t seem to suit my needs. One other thread is also not really helpful to me as it only vaguely describes the solution.
I could of course change our existing carousel script to change the markup or adapt to the new structure, but I need the same principle in other places as well.
Can you give a some more insight in what doesn’t solve your issue in the basic caroussel example? Have you managed to select the nodes you need already and only struggle with the rendering?
Of course I cannot render the items directly (as they are inside an object -> Cannot cast object of type “Neos\Fusion\FusionObjects\Helpers\FusionPathProxy” to string.). I could theoretically iterate over the object (using f:for) and access the items and thus their properties directly. But I want to avoid that as I already have node types for every included item.
In essence what I expect to build is ul.slider > li.slider__item and inside the rendered node type.
The result is the correct surrounding markup, but the children do not render, but display as: Node /sites/site/node-vmbm2ctwttgmx/main/node-lxsroodowvl5j/items/node-b7c9xj06okprd@live;language=de[SITE:ITEM]
That is because {element} is the node it self (what you see is the nodePath) so you are only missing to render the properties (like img src, title etc)
That’s exactly the point, Soren. I don’t want to render the properties by themselves, because for every item in the collection I already have a fluid template set up that should be used for rendering.
Thanks, Soren.
I get the reason and idea behind it, but my knowledge is limited.
I need a third level of templating which would be the template for the correct node type, so the hierarchy would be carousel > carouselItem > nodeType.
I’m sorry for asking that, but how do I implement the correct template?
My first idea is to make the carouselItem a contentCollection with just one item.
Update: it’s basically working, but now in every slide the whole content is rendered (every item of the collection)!
Hi, I assume you have the div with the class carousel in your fluid code, right? The easiest would be to remove that and instead use sth. like
carousel = Neos.Neos:ContentCollection {
[…]
attributes.class = ‘carousel’
}
Thanks for your fast answer. I’m still confused but at least I found a solution. With the example code from readthedocs.io it renders the HTML code:
<div class="my-carousel">
<div class="carousel slide" id="eaa3de90-7dd0-40aa-b547-e33b87396988">
<!-- Wrapper for slides -->
<div class="carousel-inner neos-contentcollection">
<div>content of slide 1</div>
<div>content of slide 2</div>
<div>content of slide 3</div>
</div>
</div>
</div>
To initialize the slides with Slick I just use the class “.carousel-inner” instead of “.carousel”. It’s not really pretty because the two wrapping div’s are useless but at least it’s working now