Make WordPress Core

Opened 17 years ago

Closed 14 years ago

#4701 closed enhancement (worksforme)

ID attribute for adminmenu items

Reported by: leonid's profile leonid Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Administration Keywords:
Focuses: Cc:


Administration menu customizations are very limited right now (think: icons for menu items), partially due to the fact that menu items don't have ID attributes. The attached patch (against trunk r5844) generates ID attributes using sanitize_title(). The resulting values look like "adminmenu_dashboard" and "submenu_write-post".

There was a preliminary OK for this functionality from Matt on wp-hackers list:

Attachments (1)

menu-header.php.diff (2.3 KB) - added by leonid 17 years ago.
Patch wp-admin/menu-header.php to have ID attributes for admin menu

Download all attachments as: .zip

Change History (12)

17 years ago

Patch wp-admin/menu-header.php to have ID attributes for admin menu

#1 @leonid
17 years ago

  • Keywords has-patch added

#2 @leonid
17 years ago

  • Milestone set to 2.3 (trunk)

#3 @ryan
17 years ago

item[0] is a translated string. It will change depending on the locale. I think we have to sanitize the filename or add a unique, consistent identifier to the menu arrays.

#4 @leonid
17 years ago

I wish that part of menu-header.php was written somehow simpler. I have to drink five pints before I can make any sense of it, and I do forget it all by the next morning. :)

On the serious note, would calling sanitize_file_name($item[2]) be sufficient or is there something else to be careful about? I can redo the patch, no problem. But I really have issues understanding some of that code (a bunch of if-then-else statements with re-indexing of a heavy array).

#5 @foolswisdom
17 years ago

  • Milestone changed from 2.3 to 2.4 (next)

#6 @ffemtcj
16 years ago

  • Milestone changed from 2.5 to 2.6

#7 @mrmist
15 years ago

  • Keywords needs-patch added; has-patch removed

This will need refreshing. I'm sure I saw a newer version of this ticket with respect to the 2.7 menu area, but now I can't find it. Otherwise I'd close this off as a dupe.

#8 @Denis-de-Bernardy
15 years ago

  • Milestone changed from 2.9 to Future Release

#9 @johnbillion
14 years ago

  • Keywords needs-patch removed
  • Milestone Future Release deleted
  • Resolution set to fixed
  • Status changed from new to closed

Invalid now. Every menu item has an ID and a bunch of classes.

#10 @nacin
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#11 @nacin
14 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.