You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a multi-site installation with two sites.
I have a section called "Articles" that is enabled for the Primary site only, and I have a section called "Pages" that is enabled for the Secondary site only.
There is a Neo field called "Blocks" that is available on both Articles and Pages.
On the Secondary Site in the Pages section, I can add selected articles to an entries field. It works as expected in the back end. When I try to output the selection on the front end, the entries field is empty.
Screenshots of the Primary Site:
Screenshots of the Secondary site:
Articles from primary site can be selected.
Article relations are empty in primary site
The related articles field allows for the site select menu:
The code to render the block field looks like this:
{% for block in entry.blocks.all() %}
{% if block['relatedArticles'] is defined %}
{% for article in block.relatedArticles.all() %}
{{ article.title }}
{% else %}
No related articles.
{% endfor %}
{% endif %}
{% endfor %}
Steps to reproduce
Configure the test content and relations
Attempt to output relationship in twig from Primary site only on Secondary Site
I'm happy to provide a DB dump or other config files if it would be helpful.
Expected behaviour
The relationships to Primary site content would be output in twig.
Neo version
4.1.2
Craft CMS version
4.9.0
What is the affected Neo field's propagation method?
Save blocks to all sites the owner element is saved in.
Does this issue involve templating, and if so, is eager-loading used?
This is not a templating issue
The text was updated successfully, but these errors were encountered:
This seems to be the case for me even when putting the entries field directly on the entry's field layout - could you please confirm whether that's what happens for you?
@ttempleton yes! I see the same behavior with the entries field on the entry itself.
Checking further, if I add a site('*') parameter to the query, then the articles from the other site are retrieved.
{% for r in entry.relatedArticles.site('*').all() %}
{{ r.title }}
{% else %}
No related articles on the entry.
{% endfor %}
{% for block in entry.blocks.all() %}
{% if block['relatedArticles'] is defined %}
{% for article in block.relatedArticles.site('*').all() %}
{{ article.title }}
{% else %}
No related articles.
{% endfor %}
{% endif %}
{% endfor %}
So what must be happening is the that the current site is used by default when no site param is specified, and we need to expressly set it to get the entries from other sites.
Bug Description
I am working on a multi-site installation with two sites.
I have a section called "Articles" that is enabled for the Primary site only, and I have a section called "Pages" that is enabled for the Secondary site only.
There is a Neo field called "Blocks" that is available on both Articles and Pages.
On the Secondary Site in the Pages section, I can add selected articles to an entries field. It works as expected in the back end. When I try to output the selection on the front end, the entries field is empty.
Screenshots of the Primary Site:
Screenshots of the Secondary site:
Articles from primary site can be selected.
Article relations are empty in primary site
The related articles field allows for the site select menu:
The code to render the block field looks like this:
Steps to reproduce
I'm happy to provide a DB dump or other config files if it would be helpful.
Expected behaviour
The relationships to Primary site content would be output in twig.
Neo version
4.1.2
Craft CMS version
4.9.0
What is the affected Neo field's propagation method?
Save blocks to all sites the owner element is saved in.
Does this issue involve templating, and if so, is eager-loading used?
This is not a templating issue
The text was updated successfully, but these errors were encountered: