Commit cd2e7e87 authored by webchick's avatar webchick
Browse files

#511286 follow-up: Committed rest of stuff.

parent 65966281
......@@ -2258,6 +2258,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.
*
......
......@@ -14,6 +14,7 @@ dependencies[] = path
dependencies[] = taxonomy
dependencies[] = dblog
dependencies[] = search
dependencies[] = shortcut
dependencies[] = toolbar
dependencies[] = field_ui
dependencies[] = file
......
......@@ -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>
......
......@@ -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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment