diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-17 01:15:40 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-17 01:15:40 +0000 |
commit | cd2e7e875aa748c7486263aa59334271cf9cf496 (patch) | |
tree | 3107e76e08e15bb5121383611aaacbf7276b03dc | |
parent | 659662810bfb1e4b81cee389809a1eff5e69e961 (diff) | |
download | brdo-cd2e7e875aa748c7486263aa59334271cf9cf496.tar.gz brdo-cd2e7e875aa748c7486263aa59334271cf9cf496.tar.bz2 |
#511286 follow-up: Committed rest of stuff.
-rw-r--r-- | includes/menu.inc | 69 | ||||
-rw-r--r-- | profiles/default/default.info | 1 | ||||
-rw-r--r-- | themes/seven/page.tpl.php | 1 | ||||
-rw-r--r-- | themes/seven/style.css | 7 |
4 files changed, 78 insertions, 0 deletions
diff --git a/includes/menu.inc b/includes/menu.inc index 40992d928..a8742f2ca 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -2259,6 +2259,75 @@ function _menu_navigation_links_rebuild($menu) { } /** + * Clone an array of menu links. + * + * @param $links + * An array of menu links to clone. + * @param $menu_name + * (optional) The name of a menu that the links will be cloned for. If not + * set, the cloned links will be in the same menu as the original set of + * links that were passed in. + * @return + * An array of menu links with the same properties as the passed-in array, + * but with the link identifiers removed so that a new link will be created + * when any of them is passed in to menu_link_save(). + * + * @see menu_link_save() + */ +function menu_links_clone($links, $menu_name = NULL) { + foreach ($links as &$link) { + unset($link['mlid']); + unset($link['plid']); + if (isset($menu_name)) { + $link['menu_name'] = $menu_name; + } + } + return $links; +} + +/** + * Returns an array containing all links for a menu. + * + * @param $menu_name + * The name of the menu whose links should be returned. + * @return + * An array of menu links. + */ +function menu_load_links($menu_name) { + $links = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC)) + ->fields('ml') + ->condition('ml.menu_name', $menu_name) + // Order by weight so as to be helpful for menus that are only one level + // deep. + ->orderBy('weight') + ->execute() + ->fetchAll(); + + foreach ($links as &$link) { + $link['options'] = unserialize($link['options']); + } + return $links; +} + +/** + * Deletes all links for a menu. + * + * @param $menu_name + * The name of the menu whose links will be deleted. + */ +function menu_delete_links($menu_name) { + $links = menu_load_links($menu_name); + foreach ($links as $link) { + // To speed up the deletion process, we reset some link properties that + // would trigger re-parenting logic in _menu_delete_item() and + // _menu_update_parental_status(). + $link['has_children'] = FALSE; + $link['plid'] = 0; + _menu_delete_item($link); + } +} + +/** * Delete one or several menu links. * * @param $mlid diff --git a/profiles/default/default.info b/profiles/default/default.info index f379c7f13..7e205eba5 100644 --- a/profiles/default/default.info +++ b/profiles/default/default.info @@ -14,6 +14,7 @@ dependencies[] = path dependencies[] = taxonomy dependencies[] = dblog dependencies[] = search +dependencies[] = shortcut dependencies[] = toolbar dependencies[] = field_ui dependencies[] = file diff --git a/themes/seven/page.tpl.php b/themes/seven/page.tpl.php index eee8cc667..71e7e0bf7 100644 --- a/themes/seven/page.tpl.php +++ b/themes/seven/page.tpl.php @@ -4,6 +4,7 @@ <div id="branding" class="clearfix"> <?php print $breadcrumb; ?> <?php if ($title): ?><h1 class="page-title"><?php print $title; ?></h1><?php endif; ?> + <?php if (isset($add_to_shortcuts)): ?><?php print $add_to_shortcuts; ?><?php endif; ?> <?php if ($primary_local_tasks): ?><ul class="tabs primary"><?php print render($primary_local_tasks); ?></ul><?php endif; ?> </div> diff --git a/themes/seven/style.css b/themes/seven/style.css index 2a838b4a0..c88a7b267 100644 --- a/themes/seven/style.css +++ b/themes/seven/style.css @@ -735,3 +735,10 @@ body.overlay #page { body.overlay #block-system-main { padding: 20px; } + +/* Shortcut theming */ +div.add-to-shortcuts { + float: left; + margin-left: 6px; + margin-top: 6px; +} |