I’d like to create a relationship module. A Relationship field provides a dual-column component to select one or more posts. The ideia is to create someting like a relation acf from worpdress, u could see an example here.
It is necessary to have a list with a checkbox field so that the desired option is chosen, those selected items will appear in the frontend.
sure this is possible. Unfortunately you’ll need to write all your options manually. There is noo option to “grab” tags automatically and display them in a custom module select option.
Something like “show x posts with tag y” would perfectly work with the blog_recent_tag_posts function.
The custom module could look like this:
- add a blog to select (“blog”)
- add a select/coice option(“tags”)
- add a number option (“tag_count”)
{% set tag_posts = blog_recent_tag_posts("module.blog_select", module.tags, module.tag_count) %}
<ul>{# for demo purposes #}
{% for post in tag_posts %}
<li>{{post.name}}</li>
{# your layout for each post comes here #}
{% endfor %}
</ul>
you can modify/expand it with options to what ever you’d like to have.
For example - you’d like to change the layout(s): add a select option(“layout_selector”) and write the code like this
{% set tag_posts = blog_recent_tag_posts("module.blog_select", module.tags, module.tag_count) %}
{% if module.layout_selector == "layout_1" %}
{# layout 1 #}
{% elif module.layout_selector == "layout_2" %}
{# layout 2 #}
{% else %} {# fallback/failsafe; optional if you don't have any option selected #}
{# fallback layout #}
{% endif %}