/[drupal]/drupal/modules/toolbar/toolbar.install
ViewVC logotype

Contents of /drupal/modules/toolbar/toolbar.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download) (as text)
Tue Oct 13 13:54:55 2009 UTC (6 weeks, 3 days ago) by dries
Branch: MAIN
CVS Tags: DRUPAL-7-0-UNSTABLE-10
Changes since 1.5: +2 -2 lines
File MIME type: text/x-php
- Patch #544360 by Gábor Hojtsy, ksenzee, David_Rothstein, seutje, JacobSingh, paul.lovvik, EclipseGc et al: Dashboard module 1.0. Wo-hoot!
1 <?php
2 // $Id: toolbar.install,v 1.5 2009/10/09 08:02:25 webchick Exp $
3
4 /**
5 * @file
6 * Installation functions for admin toolbar.
7 */
8
9 /**
10 * Implementation of hook_install().
11 *
12 * @todo
13 * Implement role based shortcut bars.
14 */
15 function toolbar_install() {
16 $t = get_t();
17 $menu = array(
18 'menu_name' => 'admin_shortcuts',
19 'title' => $t('Administration shortcuts'),
20 'description' => $t('The <em>Administration shortcuts</em> menu contains commonly used links for administrative tasks.'),
21 );
22 menu_save($menu);
23
24 // Add starter convenience shortcuts.
25 menu_rebuild();
26 $items = array(
27 'node/add' => 'Add content',
28 'admin/content' => 'Find content',
29 'admin/dashboard' => 'Dashboard',
30 );
31 $weight = -20;
32 foreach ($items as $path => $title) {
33 $link = array(
34 'mlid' => 0,
35 'link_title' => $title,
36 'link_path' => $path,
37 'router_path' => $path,
38 'menu_name' => 'admin_shortcuts',
39 'module' => 'menu',
40 'weight' => $weight,
41 );
42
43 // Check for an existing menu item before attempting to create a new one.
44 $menu_link = db_query("SELECT mlid FROM {menu_links} WHERE link_path = :path AND menu_name = :menu_name", array(
45 ':path' => $link['link_path'],
46 ':menu_name' => $link['menu_name']
47 ))
48 ->fetchField();
49 if (!$menu_link) {
50 menu_link_save($link);
51 }
52
53 // Increment weight so items can be displayed in desired order.
54 $weight++;
55 }
56 }

  ViewVC Help
Powered by ViewVC 1.1.2