Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nav tag ignores select #10503

Closed
dannyuk1982 opened this issue Jul 24, 2024 · 4 comments · Fixed by #10226
Closed

nav tag ignores select #10503

dannyuk1982 opened this issue Jul 24, 2024 · 4 comments · Fixed by #10226

Comments

@dannyuk1982
Copy link

dannyuk1982 commented Jul 24, 2024

Bug description

selecting fields for the nav tag appears to be ignored and all fields are selected regardless

How to reproduce

{{ nav:main select="title" }}
{{ url }}
{{ /nav:main }}

This still outputs the urls for each entry in the main nav, it shouldn't as they haven't been selected

Logs

No response

Environment

Environment
Laravel Version: 11.10.0
PHP Version: 8.3.8
Composer Version: 2.6.5
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Addons: 3
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.17.0 PRO

Statamic Addons
edalzell/forma: 3.0.1
statamic-rad-pack/mailchimp: 5.0.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@duncanmcclean
Copy link
Member

duncanmcclean commented Jul 24, 2024

The select parameter was accidentally removed in Statamic 5.

We have an draft pull request to add it back, but we haven't got around to finishing it off yet, see #10226.

@dannyuk1982
Copy link
Author

Probably worth removing from the docs until it's back?

@dannyuk1982
Copy link
Author

A comment on that PR, it's not just useful for speed. Here is a use case:

The hero and top nav area can be green or orange, each page can differ. This is stored for each entry as a variable, i.e. nav_bg. When the view for that entry loads that sets the nav's bg, great.

That entry is also part of the nav, because the nav is part of that nav area, for just that iteration of the loop that nav_bg variable then is different to the current entry's value. This now messes up the colours for the hover state and dropdown colours etc.

Just being able to select only the title/url would fix this.

tl;dr if you could add it back that would be great as it's not just for performance in some cases!

@codepilotnl
Copy link

Another common use case for the select parameter is limiting the Json data passed to a VueJS navigation component.

Modifying nav data to Json is also much slower because of the missing select functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants