Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a module called quickbar which is like admin 1.0 toolbar without the theme. Is there something I can do to help support this module? Or what is needed so this module can support quickbar?
Comments
Comment #1
Deciphered CreditAttribution: Deciphered commentedHi redndahead,
I really should have put together some api documentation, but I wrote this module last night during the Drupal Melbourne meetup and finished it off during my train trip home, so it's a bit of a quicky.
There's two hooks that your module (or admin_select on behalf of your module) needs to declare to add support, examples can be seen in 'includes/admin.inc' and 'includes/admin_menu.inc'.
hook_admin_select_module()
adds your module to the list of available choices.hook_admin_select_init()
is passed a variable containing the name of the selected admin menu module, so you need to check if it's not your module, and if not you need to suppress your menu from showing up. Both admin and admin_menu have a _suppress() function that can be called, quickbar doesn't seem to, but you might have some other method to do it. At the least, you could right the code that disables quickbar directly inside this hook.I'd be more than happy to help more with this if this information is not enough.
Cheers,
Deciphered.
Comment #2
Deciphered CreditAttribution: Deciphered commentedI'd suggest holding off for a little bit, based on Dave Reids patches I will likely change the API in 1.1 (which should be out by today).
Comment #3
Deciphered CreditAttribution: Deciphered commentedThe new API (pending any last minute changes) will now be one single function, attached is the example for the api.php file:
If you need any help I would be more than happy to provide it.
Comment #4
redndahead CreditAttribution: redndahead commentedso I added support for this module into quickbar. I ran into some issues though. Since admin_select is set weighted lower than quickbar the suppress never takes place. To fix this I did my own checking to see if the admin select data was set and work accordingly. So I think one of either 2 things would be nice.
1) admin_select gets weighted higher.
2) There is a function admin_select_is_active($module) It could look like this:
so I can do admin_select_is_active('quickbar') and verify that quickbar should be active. Maybe a get active would work also. Which would return the active admin toolbar.
Comment #5
Deciphered CreditAttribution: Deciphered commentedHI redndahead,
I noticed a similar issue in the Toolbar module, the suppress call was being checked in hook_init(), whereas both Admin and Admin menu check in hook_footer(), which seems to work fine. They do still add there JS and CSS in hook_init(). Toolbar re-arranged some things and got it working fine, though I don't think it's using hook_footer().
Do either of those options appeal?
Also, on a side not, I added another feature to the Admin and Admin menu integrations in the dev releases, not something that I can really make a hook for as, but basically it's adding a quick-switched to each menu. Admin gets a block and Admin menu gets a menu (under the icon item). The Block and Menu are both defined by the Admin Menu select module, so if you can inject a menu or block into Quickbar anyway it would be great to also add this functionality.
Cheers,
Deciphered.
Comment #6
Deciphered CreditAttribution: Deciphered commentedAlso, correct me if I'm wrong, but you've only put the suppress method in dev? (just testing)
Comment #7
redndahead CreditAttribution: redndahead commentedTagging
Comment #8
redndahead CreditAttribution: redndahead commentedI think what's implemented is what it's going to be. ;)