diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-07-04 05:37:30 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-07-04 05:37:30 +0000 |
commit | 7f1606632dd96aff2aea73c95faf50cd35e454a4 (patch) | |
tree | fec81a59bbaa36870bb160156e65f45623cf3848 /modules/toolbar/toolbar.install | |
parent | b9f4e59c5a4655595e3254560febbdb01d599fd1 (diff) | |
download | brdo-7f1606632dd96aff2aea73c95faf50cd35e454a4.tar.gz brdo-7f1606632dd96aff2aea73c95faf50cd35e454a4.tar.bz2 |
- Patch #484820 by Gábor Hojtsy, yhahn, markboulton, leisareichelt, et al: initial version of the new administration toolbar.
Diffstat (limited to 'modules/toolbar/toolbar.install')
-rw-r--r-- | modules/toolbar/toolbar.install | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/modules/toolbar/toolbar.install b/modules/toolbar/toolbar.install new file mode 100644 index 000000000..25442eaeb --- /dev/null +++ b/modules/toolbar/toolbar.install @@ -0,0 +1,57 @@ +<?php +// $Id$ + +/** + * @file + * Installation functions for admin toolbar. + */ + +/** + * Implementation of hook_install(). + * + * @todo + * Implement role based shortcut bars. + */ +function toolbar_install() { + $t = get_t(); + $query = db_insert('menu_custom') + ->fields(array( + 'menu_name' => 'admin_shortcuts', + 'title' => $t('Administration shortcuts'), + 'description' => $t('The <em>Admininstration shortcuts</em> menu contains commonly used links for administrative tasks.') + )) + ->execute(); + + // Add starter convenience shortcuts. + menu_rebuild(); + $items = array( + 'node/add' => 'Add', + 'admin/content/node' => 'Find content', + 'admin' => 'Dashboard', + ); + $weight = -20; + foreach ($items as $path => $title) { + $link = array( + 'mlid' => 0, + 'link_title' => $title, + 'link_path' => $path, + 'router_path' => $path, + 'menu_name' => 'admin_shortcuts', + 'module' => 'menu', + 'weight' => $weight, + ); + + // Check for an existing menu item before attempting to create a new one. + $menu_link = db_query("SELECT mlid FROM {menu_links} WHERE link_path = :path AND menu_name = :menu_name", array( + ':path' => $link['link_path'], + ':menu_name' => $link['menu_name'] + )) + ->fetchField(); + if (!$menu_link) { + menu_link_save($link); + } + + // Increment weight so items can be displayed in desired order. + $weight++; + } +} |