Skip to content

feat(contexts): nest application menu items one level deep - #22

Open
remko48 wants to merge 7 commits into
stack/m2-menu-savingfrom
stack/m3-menu-nesting
Open

remko48 wants to merge 7 commits into
stack/m2-menu-savingfrom
stack/m3-menu-nesting

Conversation

@remko48

@remko48 remko48 commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

A menu item can now sit under another item, so an application's menu can group its pages. Only one level deep: a parent cannot itself have a parent.

What changes

  • Migration: tables_contexts_menu_item gets a nullable parent_id.
  • Input: an item names its parent with parentIndex, the position of the parent in the same payload (a non-negative whole number). Positions are used instead of ids because the whole menu is replaced on save, and new items don't have an id yet.
  • Validation (400): the parent must exist in the same menu, cannot be the item itself, and must be a top-level item.
  • Saving: top-level items are stored first so their new ids are known; then the children are stored with their parent_id. A parent may therefore come after its child in the payload. order keeps the sequence of the whole payload.
  • API: parentId is added to each menu item in the response (OpenAPI and TS types regenerated).

Page target

The rewritten menu parameter docs include 'page' next to parentIndex. Children under the dashboard item work like under any other item. Since create stores a submitted menu as it is (#21), no parentIndex needs shifting. Tests: ContextServiceTest::testCreateKeepsChildrenOfASubmittedMenuUnderTheirParent, testCreateStoresChildrenUnderTheStartPageItem, MenuItemInputTest::testResolvingTheStartPageKeepsTheParent. Prepared in the Conduction fork for porting upstream by @remko48. Prepared with Claude Code.

🖼️ Screenshots

Backend only, no UI changes.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stableX.X
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

A menu item can sit under a top-level item of the same menu. The parent is
given as its position in the submitted menu, so a new menu can be saved in
one request; parents are stored first so a child can point at its parent's
id, while the order keeps the menu's sequence.

- an item cannot sit under itself, under a child or under a position the
  menu does not have; the service keeps its own check for items built
  without the input validation
- menu items expose their parentId in the API

Co-authored-by: Ruben van der Linde <ruben@conduction.nl>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Remko <remko@conduction.nl>
@remko48
remko48 added this pull request to stack #24 October 12, 2026 11:39
Comment thread lib/Model/MenuItemInput.php Outdated
Comment thread lib/Db/MenuItem.php
@remko48 remko48 closed this Oct 13, 2026
@remko48 remko48 reopened this Oct 13, 2026
@github-actions github-actions Bot added the AI assisted This PR contains AI-assisted commits label Oct 13, 2026
remko48 and others added 5 commits October 13, 2026 12:59
…t in the output

- an item placed under itself is already refused because its parent then has a
  parent too, so comparing the parent's position with its own adds nothing
- the serialization test now sets a parent and checks that it is returned

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Remko <remko@conduction.nl>
The menu parameters document both page targets and parentIndex. The
dashboard item put in front of a new application's menu moves every
parent position down by one, so children stay under their parent.

Assisted-by: ClaudeCode:claude-opus-5-5
# Conflicts:
#	lib/Controller/ContextController.php
#	lib/Service/ContextService.php
#	openapi.json
#	src/types/openapi/openapi.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants