fix(navigation): align mega-menu rendering and menu-item backend with the reference

Renderer:
- Graphic-card images carry fit-cover so they crop into the fixed card box
  instead of stretching it and pushing the title out of alignment.
- Mega-menu link icons use fa-fw (fixed glyph column) instead of the
  undefined menu-item-icon class, so link titles line up.

Backend:
- Restore show_policy (login / vip / vip_2 / auth) on menu items; the field
  was missing entirely, so items could not be gated by identity.
- Default submenu_type to graphic_card, badge_class to jb-red, arrangement
  to swiper, size to md.
- Clamp img_scale to 20-300 to match the reference's spinner bounds.
- Drop the now-meaningless "none" submenu_type option: the senior-submenu
  switch is itself the on/off control.
- Admin JS gains the align control (left/center/space-around).

Cleanup:
- Remove the unused header_actions nav menu location.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-05 10:51:36 +08:00
1 parent 55423403a6
commit e6d9ff49a2
6 files changed
+113 -29

No files matched your search

@@ -133,7 +133,11 @@ test('custom settings pages and standalone save paths speak the three icon forma
test('nav menu icons render every format without legacy fa-prefix mangling', () => {
const helper = read('inc/helpers/menu-decoration.php');
assert.match(helper, /str_starts_with\(\$icon_class, 'jiosvg-'\)/);
assert.match(helper, /jio_icon_markup\(\$icon_class, 'icon mr3 menu-item-icon'\)/);
// Top-level titles keep the default glyph classes; mega-menu lists pass
// `mr3 fa-fw` so every row's icon occupies the same column.
assert.match(helper, /\$extra_classes = 'mr3 menu-item-icon'/);
assert.match(helper, /jio_icon_markup\(\$icon_class, \$extra\)/);
assert.match(read('src/Frontend/NavWalker.php'), /jio_render_menu_icon\(\(string\) \$args\['icon'\], true, 'mr3 fa-fw'\)/);
assert.doesNotMatch(helper, /'<i class="' \. esc_attr\(\$icon_class\)/, 'no raw i-tag bypassing the unified helper');
});