Skip to content

[6.x] Render product sources in the secondary nav - #4379

Draft
brianjhanson wants to merge 6 commits into
6.xfrom
feature/product-sources-subnav
Draft

brianjhanson wants to merge 6 commits into
6.xfrom
feature/product-sources-subnav

Conversation

@brianjhanson

Copy link
Copy Markdown

Puts the product types in the control panel's secondary nav, and offers Customize Sources beside them, so the products index reads the way Craft 5's did.

The index's view model already described them — sourceNavItems arrives on the page with an "All products" entry and a group holding each product type — but nothing consumed it, so the sidebar sat empty while the types were only reachable from the global nav.

useAppLayout(() => ({
  subnav: props.sourceNavItems ?? [],
  subnavActions: subnavActions.value,
}));

useCustomizeSources() returns an empty list for anyone the server would refuse, so the entry is only offered to those it would accept.

Important

Depends on craftcms/cms#19884. Both useAppLayout and useCustomizeSources are added to the @craftcms/cms/elements import map by that PR, and subnav only became something a page can set there — until then it was read solely from the server's own page prop, so no Vue page could supply its own nav. Without it this import fails to resolve and the index won't boot.

Testing

Against a store with four product types: each appears under a "Product Types" heading in the sidebar, "All products" is selected on the index itself, and Customize Sources shows for an admin with allowAdminChanges on.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NjeigCjRgjTJpnhbvyrxv8

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants