Navigation Query Builder and in Blade #8498
Unanswered
Dimchao
asked this question in
Troubleshooting
Replies: 1 comment 5 replies
-
What actual parameter are you trying to use? When using the blade syntax, the method needs to either be the parameter, or a Statamic::tag('collection:pages')->limit(3);
// or
Statamic::tag('collection:pages')->param('limit', '3'); In your example you should be doing: ->param('param:is', 'my_value') Your first example doesn't work either. It just seems to work because only published items are shown by default. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Does anyone know how to run a query builder command for the Statamic::tag('nav:my_navigation)? I can do it for collections:pages, but for nav, it doesn't do anything.
So far:
Statamic::tag('collection:pages')->where('statis:is',
'published')->fetch();`works as expected.
However:
Statamic::tag('nav:my_navigation')->where('param:is', 'my_value')->fetch();
does nothing but return everything in the 'nav:my_navigation'.
Is this not a feature? The help docs mention that you can do this in antlers, but is full on not working/not implemented otherwise?
New to Statamic, and this seems like user error on my end...?
Basically, I will be handing off the CMS to the client, and it makes sense for all of their menus to be in the 'Navigation' sidebar. However, when creating a toggle field 'enabled', looping through it is a pain considering I have to use $menuItem->enabled->value(), which throws an error if enabled isn't set in the yaml files... which is something that happens when saving a toggle field that is set to false.
Beta Was this translation helpful? Give feedback.
All reactions