Commit d3069f0e authored by catch's avatar catch

Issue #891670 by sun, bleen18: Added a Footer menu to the built-in system menus.

parent a3067d6a
......@@ -1753,6 +1753,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,34 @@ 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;
$existing = $link;
if (isset($link_title)) {
$link['link_title'] = $link_title;
}
$link['options'] = unserialize($link['options']);
menu_link_save($link, $existing);
}
break;
case 'enable':
case 'disable':
$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) {
$existing = $link;
$link['hidden'] = ($op == 'disable' ? 1 : 0);
$link['customized'] = 1;
if (isset($link_title)) {
$link['link_title'] = $link_title;
}
$link['options'] = unserialize($link['options']);
menu_link_save($link);
menu_link_save($link, $existing);
}
break;
case 'delete':
menu_link_delete(NULL, $link_path);
break;
......
......@@ -97,7 +97,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',
);
......
......@@ -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();
}
......@@ -325,14 +325,15 @@ function simpletest_test_get_all() {
$classes = array();
$module_data = system_rebuild_module_data();
$all_data = $module_data + system_rebuild_theme_data();
$all_data += drupal_system_listing('/\.profile$/', 'profiles', 'name');
foreach ($all_data as $name => $data) {
// Build directory in which the test files would reside.
$tests_dir = DRUPAL_ROOT . '/' . dirname($data->filename) . '/lib/Drupal/' . $name . '/Tests';
$tests_dir = DRUPAL_ROOT . '/' . dirname($data->uri) . '/lib/Drupal/' . $name . '/Tests';
// Scan it for test files if it exists.
if (is_dir($tests_dir)) {
$files = file_scan_directory($tests_dir, '/.*\.php/');
if (!empty($files)) {
$basedir = DRUPAL_ROOT . '/' . dirname($data->filename) . '/lib/';
$basedir = DRUPAL_ROOT . '/' . dirname($data->uri) . '/lib/';
foreach ($files as $file) {
// Convert the file name into the namespaced class name.
$replacements = array(
......
<?php
/**
* @file
* Contains Drupal\standard\Tests\StandardTest.
*/
namespace Drupal\standard\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Tests Standard installation profile expectations.
*/
class StandardTest extends WebTestBase {
protected $profile = 'standard';
public static function getInfo() {
return array(
'name' => 'Standard installation profile',
'description' => 'Tests Standard installation profile expectations.',
'group' => 'Standard',
);
}
/**
* Tests Standard installation profile.
*/
function testStandard() {
$this->drupalGet('');
$this->assertLink(t('Contact'));
$this->clickLink(t('Contact'));
$this->assertResponse(200);
}
}
......@@ -9,6 +9,7 @@ dependencies[] = color
dependencies[] = config
dependencies[] = comment
dependencies[] = contextual
dependencies[] = contact
dependencies[] = help
dependencies[] = image
dependencies[] = menu
......
......@@ -118,6 +118,16 @@ function standard_install() {
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'menu-footer',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'footer',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'powered-by',
......@@ -401,6 +411,11 @@ function standard_install() {
);
menu_link_save($item);
// Enable the Contact link in the footer menu.
menu_link_maintain('system', 'enable', 'contact');
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access site-wide contact form'));
// Populate the default shortcut set.
$shortcut_set = shortcut_set_load(SHORTCUT_DEFAULT_SET_NAME);
$shortcut_set->links[] = array(
......@@ -415,9 +430,6 @@ function standard_install() {
);
shortcut_set_save($shortcut_set);
// Update the menu router information.
menu_router_rebuild();
// Enable the admin theme.
theme_enable(array('seven'));
variable_set('admin_theme', 'seven');
......
......@@ -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';
}
}
......
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