Opened 6 years ago

Closed 3 years ago

#4701 closed enhancement (worksforme)

ID attribute for adminmenu items

Reported by: leonid Owned by: anonymous
Priority: normal Milestone:
Component: Administration Version:
Severity: normal Keywords:
Cc:

Description

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:
http://comox.textdrive.com/pipermail/wp-hackers/2007-July/013746.html

Attachments (1)

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

Download all attachments as: .zip

Change History (12)

leonid6 years ago

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

  • Keywords has-patch added
  • Milestone set to 2.3 (trunk)

comment:3   ryan6 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.

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).

  • Milestone changed from 2.3 to 2.4 (next)
  • Milestone changed from 2.5 to 2.6
  • 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.

  • Milestone changed from 2.9 to Future Release
  • 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.

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