[wp-trac] [WordPress Trac] #20052: Support sprites for admin menu icons in register_post_type and add_menu_page
WordPress Trac
wp-trac at lists.automattic.com
Fri Jul 27 15:44:21 UTC 2012
#20052: Support sprites for admin menu icons in register_post_type and
add_menu_page
----------------------------+-----------------------------
Reporter: helenyhou | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Administration | Version:
Severity: normal | Resolution:
Keywords: has-patch |
----------------------------+-----------------------------
Comment (by bradyvercher):
I gotcha and see what you're doing now regarding backwards compatibility.
The thing is that most of those changes to the existing code are
unnecessary and the back-compat check in `admin_head` can be removed. All
the patch really needs to be concerned with (in this instance, regarding
post types) is whether or not '`menu_icon`' is an array, and if so,
generate the CSS to overload the current styles. Just my thoughts on the
current approach.
A couple of other things I noticed:
* The '`background_size`' argument shouldn't ever really be necessary for
the regular icon.
* Selectors need to be added for the current/active state for both sizes
(when the menu item is selected -- .wp-has-current-submenu).
* I think `explode()` would be preferred to `preg_split()`.
* You can probably continue if the '2x' array isn't set.
* Maybe I'm being dense here, but I can't imagine a scenario when
'`background_size`' wouldn't be required for retina support, so maybe
continue if that isn't set, too?
* The logical comparisons should be switched according to the coding
standards: `if ( 2 == count( $xy ) )`
Aside from that, it looks like some of the selectors being output in the
head could potentially have a bunch of whitespace if optional arguments
aren't defined and some of them may not even have any rules.
I don't mean to be overly nitpicky, it looks like a good start, this is
just something I'd definitely like to use in the future instead of the
current method!
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20052#comment:35>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list