[wp-hackers] 2.7 Wireframes
Peter Westwood
peter.westwood at ftwr.co.uk
Wed Oct 15 12:09:20 GMT 2008
Ozh wrote:
>>> (2) I am looking forward to seeing these new 'icons' on the top
>>> level menus.
>>> Is there going to be an API to allow plugins to define their own?
>>>
>> Good question. I haven't thought about it yet. Ideas on API?
>>
>
> For what it's worth, this is something I've implemented in my Admin Drop
> Down plugin, where other plugins can define their own icon in the menus.
>
> I think the ideal API for plugins should be something like:
> add_filter('menu_icon', 'myplugin_icon');
> function myplugin_icon($plugin) {
> if ($plugin == plugin_basename(__FILE__))
> return 'url/to/icon.png';
> return $plugin;
> }
>
>
I think that it should either be passed into add_*_page or we should
fire a filter which is based on plugin_basename like the
activate/deactivate ones so that we don't need to call/write unecessary
code.
e.g.
add_filter('menu_icon_my_plugin', 'myplugin_icon');
function myplugin_icon($default_url) {
return 'url/to/icon.png';
}
I prefer the add_*_page version though. As we currently have for
add_menu_page - [9182]
westi
--
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5
More information about the wp-hackers
mailing list