I've made a projects structure with inside a couple of projects. On the homepage people can fill in a matrix with either a project or a textblock.
I'm capable of looping through the detail pages in the order that they've been made in the Projects section. I can't however make them loop in the order the client orders his Matrix. I'm capable of finding the current detail page I'm on by using relatedTo(entry) however I'm uncapable of using getPrev / getNext.
{% set source = craft.entries.id(2).first().projectList.type('project').entries.relatedTo(entry) %}
{% for collection in source %}
{% for project in collection.projectEntry %}
<p>{{project}}</p>
{% endfor %}
{% endfor %}
This returns the current project I'm visiting. Even when using getPrev(entry) or getPrev(source) in there it keeps on returning my current project instead of the prev/next
{% set prev = collection.getPrev() %}
Not sure what the previous element should be to be honestcraft.entries.id(2).first().projectList.type('project').relatedTo(entry)
{% set source = craft.entries.id(2).first().projectList.type('project').entries.relatedTo(entry) %}
{% set previous = source.getPrev() %}
{% for collection in previous %}
{% for project in collection.projectEntry %}
<p>{{project}}</p>
{% endfor %}
{% endfor %}
{% set prev = collection.getPrev(craft.entries.id(2).first().projectList.type('project').relatedTo(entry)) %}