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
Both of these enhancements would solve my immediate problem, but each is also useful in its own right IMHO.
My problem is (was) that I wanted to incorporate some modular items (which I tagged 'visible' in frontmatter) into my navigation menu (as hash fragment links, what some people call jumplinks). So, since the collection filters treat modular and non-modular children mutually exclusively, I thought I'd just merge one into the other. (Twig's merge filter produces an array result.)
Firstly, if I'd been able to grab both types in a single filter, the problem would not have arisen.
Secondly, there doesn't seem to be a nifty way to combine two Grav page collections. Thanks to @mahagr I came up with a kludgy way:
{% setmenu_pages=page.children.visible %}
{% forfraginpage.children.modulariffrag.header.visible %}
{% setmenu_pages= menu_pages.addPage(frag) %}
{% endfor %}
{# there may also be a more concise way to do this using page.evaluate() but we couldn't figure that out #}
but I think it should be a standard method in PHP and exposed to Twig :)
The text was updated successfully, but these errors were encountered:
I think it's still worth considering an "all children" filter down the track, but this solves my problem in that I can undo my messy workaround. Loving this kind of responsiveness to issues as I build sites, can usually get the solution through core updates within a few days :)
Both of these enhancements would solve my immediate problem, but each is also useful in its own right IMHO.
My problem is (was) that I wanted to incorporate some modular items (which I tagged 'visible' in frontmatter) into my navigation menu (as hash fragment links, what some people call jumplinks). So, since the collection filters treat modular and non-modular children mutually exclusively, I thought I'd just merge one into the other. (Twig's merge filter produces an array result.)
Firstly, if I'd been able to grab both types in a single filter, the problem would not have arisen.
Secondly, there doesn't seem to be a nifty way to combine two Grav page collections. Thanks to @mahagr I came up with a kludgy way:
but I think it should be a standard method in PHP and exposed to Twig :)
The text was updated successfully, but these errors were encountered: