diff --git a/core/includes/menu.inc b/core/includes/menu.inc index c7fcd92..6f58e58 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -1755,6 +1755,7 @@ function menu_list_system_menus() { 'admin' => 'Administration', 'account' => 'User account menu', 'main' => 'Main navigation', + 'footer' => 'Footer menu', ); } @@ -3321,22 +3322,22 @@ function _menu_find_router_path($link_path) { } /** - * Inserts, updates, or deletes an uncustomized menu link related to a module. + * Inserts, updates, enables, disables, or deletes an uncustomized menu link. * - * @param $module - * The name of the module. - * @param $op - * Operation to perform: insert, update or delete. - * @param $link_path + * @param string $module + * The name of the module that owns the link. + * @param string $op + * Operation to perform: insert, update, enable, disable, or delete. + * @param string $link_path * The path this link points to. - * @param $link_title - * Title of the link to insert or new title to update the link to. + * @param string $link_title + * (optional) Title of the link to insert or new title to update the link to. * Unused for delete. * - * @return + * @return integer|null * The insert op returns the mlid of the new item. Others op return NULL. */ -function menu_link_maintain($module, $op, $link_path, $link_title) { +function menu_link_maintain($module, $op, $link_path, $link_title = NULL) { switch ($op) { case 'insert': $menu_link = array( @@ -3345,15 +3346,32 @@ function menu_link_maintain($module, $op, $link_path, $link_title) { 'module' => $module, ); return menu_link_save($menu_link); - break; + case 'update': $result = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path AND module = :module AND customized = 0", array(':link_path' => $link_path, ':module' => $module))->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $link) { - $link['link_title'] = $link_title; + if (isset($link_title)) { + $link['link_title'] = $link_title; + } $link['options'] = unserialize($link['options']); menu_link_save($link); } break; + + case 'enable': + case 'disable': + $hidden = ($op == 'disable' ? 1 : 0); + $result = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path AND module = :module AND customized = 0", array(':link_path' => $link_path, ':module' => $module))->fetchAll(PDO::FETCH_ASSOC); + foreach ($result as $link) { + $link['hidden'] = $hidden; + if (isset($link_title)) { + $link['link_title'] = $link_title; + } + $link['options'] = unserialize($link['options']); + menu_link_save($link); + } + break; + case 'delete': menu_link_delete(NULL, $link_path); break; diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 1087308..4bdb4c0 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -90,7 +90,7 @@ function contact_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('contact_site_form'), 'access arguments' => array('access site-wide contact form'), - 'menu_name' => 'main', + 'menu_name' => 'footer', 'type' => MENU_SUGGESTED_ITEM, 'file' => 'contact.pages.inc', ); diff --git a/core/modules/menu/menu.install b/core/modules/menu/menu.install index 20277a7..65a1e59 100644 --- a/core/modules/menu/menu.install +++ b/core/modules/menu/menu.install @@ -51,6 +51,7 @@ function menu_install() { 'account' => $t('Links related to the user account.'), 'admin' => $t('Contains links to administrative tasks.'), 'main' => $t('Use this for linking to the main site sections.'), + 'footer' => $t('Use this for linking to site information.'), ); foreach ($system_menus as $menu_name => $title) { $menu = array( @@ -101,3 +102,16 @@ function menu_update_8001() { } } +/** + * Adds the footer menu to custom menus. + */ +function menu_update_8002() { + db_insert('menu_custom') + ->fields(array( + 'menu_name' => 'footer', + 'title' => 'Footer menu', + 'description' => 'Use this for linking to site information.', + )) + ->execute(); +} + diff --git a/core/profiles/standard/standard.info b/core/profiles/standard/standard.info index 8b8a33b..44739cc 100644 --- a/core/profiles/standard/standard.info +++ b/core/profiles/standard/standard.info @@ -7,6 +7,7 @@ dependencies[] = block dependencies[] = color dependencies[] = comment dependencies[] = contextual +dependencies[] = contact dependencies[] = help dependencies[] = image dependencies[] = menu diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index b4dc761..7fd4024 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -120,6 +120,16 @@ function standard_install() { ), array( 'module' => 'system', + 'delta' => 'menu-footer', + 'theme' => $default_theme, + 'status' => 1, + 'weight' => 0, + 'region' => 'footer', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', 'delta' => 'powered-by', 'theme' => $default_theme, 'status' => 1, @@ -401,6 +411,9 @@ function standard_install() { ); menu_link_save($item); + // Enable the Contact link in the footer menu. + menu_link_maintain('system', 'enable', 'contact'); + // Populate the default shortcut set. $shortcut_set = shortcut_set_load(SHORTCUT_DEFAULT_SET_NAME); $shortcut_set->links[] = array( diff --git a/core/themes/bartik/template.php b/core/themes/bartik/template.php index 5373c92..9a6c8a9 100644 --- a/core/themes/bartik/template.php +++ b/core/themes/bartik/template.php @@ -114,8 +114,8 @@ function bartik_process_maintenance_page(&$variables) { * Implements hook_preprocess_HOOK() for block.tpl.php. */ function bartik_preprocess_block(&$variables) { - // In the header region visually hide block titles. - if ($variables['block']->region == 'header') { + // In the header and footer regions visually hide block titles. + if ($variables['block']->region == 'header' || $variables['block']->region == 'footer') { $variables['title_attributes']['class'][] = 'element-invisible'; } }