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
When using the {% nav %} tag, as described here, it seems to be incorrectly assigning the children of a disabled entry to the previously enabled entry.
Steps to reproduce
Have a Structure, and have two root level entries "Parent 1" and "Parent 2", and two child entries "Child 1" and "Child 2" under "Parent 2". All entries are 'Enabled'.
Use the {% nav %} loop referenced above to output those entries in a nested fashion
{% set aboutPages = craft.entries.section('pages').all() %}
{% if aboutPages | length %}
{% nav page in aboutPages %}
<li>
{% if page.parent %}[Parent: {{ page.parent.title }}] {{ page.getLink() }}
{% ifchildren %}
<ul>
{% children %}
</ul>
{% endifchildren %}
</li>
{% endnav %}
{% endif %}
That should output
Parent 1
Parent 2
[Parent: Parent 2] Child 1
[Parent: Parent 2] Child 2
Now 'Disable' the root entry 'Parent 2'
Expected behavior
I would expect that, since Parent 2 is disabled, it would not show and its children would not either. Something like:
Parent 1
And if "Child 1" and "Child 2" were to show, I would think the {{ page.parent.title }} tag would show their actual parent
Actual behavior
However, it seems to output the children of "Parent 2" anyway, and thinks their parent is "Parent 1"
Parent 1
[Parent: Parent 1] Child 1
[Parent: Parent 1] Child 2
Craft CMS version
3.7.27.2
PHP version
7.3.33
Operating system and version
No response
Database type and version
MySQL 5.7.37
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered:
What happened?
Description
When using the
{% nav %}
tag, as described here, it seems to be incorrectly assigning the children of a disabled entry to the previously enabled entry.Steps to reproduce
{% nav %}
loop referenced above to output those entries in a nested fashionExpected behavior
I would expect that, since Parent 2 is disabled, it would not show and its children would not either. Something like:
And if "Child 1" and "Child 2" were to show, I would think the
{{ page.parent.title }}
tag would show their actual parentActual behavior
However, it seems to output the children of "Parent 2" anyway, and thinks their parent is "Parent 1"
Craft CMS version
3.7.27.2
PHP version
7.3.33
Operating system and version
No response
Database type and version
MySQL 5.7.37
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered: