WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 10 months ago

#19064 closed enhancement (fixed)

Pass $depth argument to nav_menu_css_class filter

Reported by: cyclometh Owned by: cyclometh
Milestone: 4.1 Priority: normal
Severity: normal Version: 3.2.1
Component: Menus Keywords: has-patch needs-docs
Focuses: Cc:

Description

function start_el() in nav-menu-template.php receives a $depth argument, representing the nesting level of the current menu item, but does not pass it to the nav_menu_css_class filter.

Passing the $depth argument allows one to create classes on a menu item such as menu-item-depth-1, menu-item-depth-2, etc by hooking the nav_menu_css_class filter.

Attachments (3)

nav-menu-template.php.diff (736 bytes) - added by cyclometh 4 years ago.
Attaching patch. Updates only one file, nav-menu-template.php.
nav-menu-template.php.2.diff (809 bytes) - added by chriscct7 10 months ago.
19064.3.diff (796 bytes) - added by kpdesign 10 months ago.
Add 4.1.0 changelogs

Download all attachments as: .zip

Change History (20)

@cyclometh4 years ago

Attaching patch. Updates only one file, nav-menu-template.php.

comment:1 @Cyclometh4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

comment:2 @ocean904 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Tickets are marked as fixed when a change is made to the WordPress codebase, the patch here still needs to be committed before the ticket will be marked as such.

comment:3 @Cyclometh4 years ago

I see, I thought it was in limbo because it was assigned to me and not resolved although it had a patch. Thank you for the clarification.

comment:4 @soulseekah3 years ago

  • Cc gennady@… added

comment:5 @soulseekah3 years ago

  • Version changed from 3.2.1 to 3.3.1

comment:6 @ocean903 years ago

  • Version changed from 3.3.1 to 3.2.1

Version number indicates when the enhancement was initially reported.

comment:7 @soulseekah3 years ago

I see, I thought it was in limbo because it was a lower version and not resolved although it had a patch. Thank you for the clarification.

comment:8 @chriscct710 months ago

  • Severity changed from minor to normal

Patch is still valid

comment:9 @johnbillion10 months ago

  • Keywords needs-docs added

Patch needs a hook doc.

comment:10 @chriscct710 months ago

  • Keywords needs-docs removed

Adds docs for the patch

comment:11 @chriscct710 months ago

  • Keywords commit added

Milestone needs to be set to 4.1 but other then that this is good to go now. Pretty straightforward patch: 1 line added for adding the doc for a new depth parameter, 1 line changed for actually adding it

comment:12 @johnbillion10 months ago

  • Milestone changed from Awaiting Review to 4.1

comment:13 @johnbillion10 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 30358:

Add $depth parameter to the nav_menu_css_class, nav_menu_item_id, and nav_menu_link_attributes filters.

Fixes #19064
Props cyclometh, chriscct7, johnbillion

comment:14 @johnbillion10 months ago

Added the $depth parameter to all three of the filters in that method.

comment:15 @DrewAPicture10 months ago

  • Keywords needs-docs added; commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

A 4.1.0 entry should be added to the changelogs for those three hooks where the $depth parameter was added:

  • nav_menu_css_class
  • nav_menu_item_id
  • nav_menu_link_attributes

@kpdesign10 months ago

Add 4.1.0 changelogs

comment:16 @kpdesign10 months ago

19064.3.diff adds 4.1.0 changelogs for the nav_menu_css_class, nav_menu_item_id, and nav_menu_link_attributes hooks per comment:15.

comment:17 @DrewAPicture10 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 30485:

Update the DocBlock changelogs for the nav_menu_css_class, nav_menu_item_id, and nav_menu_link_attributes hooks following [30358], where $depth parameters were added.

Props kpdesign.
See [30358]. Fixes #19064.

Note: See TracTickets for help on using tickets.