Commit 251a761e authored by webchick's avatar webchick

#337820 by Dave Reid: Rename menu path 'logout' to 'user/logout' for consistency.

parent 079a1bd2
......@@ -851,7 +851,7 @@ function form_error(&$element, $message = '') {
* $_POST data.
*/
function form_builder($form_id, $form, &$form_state) {
static $complete_form, $cache, $file;
static $complete_form, $cache, $enctype;
// Initialize as unprocessed.
$form['#processed'] = FALSE;
......@@ -864,6 +864,7 @@ function form_builder($form_id, $form, &$form_state) {
if (isset($form['#type']) && $form['#type'] == 'form') {
$cache = NULL;
$enctype = NULL;
$complete_form = $form;
if (!empty($form['#programmed'])) {
$form_state['submitted'] = TRUE;
......@@ -937,6 +938,12 @@ function form_builder($form_id, $form, &$form_state) {
unset($form_state['buttons']);
}
// If an element requires to set the forms content type enctype attribute, we
// need to store this info in a static $enctype flag to update the parent
// form element. E.g. For files, non-ASCII data, and binary data.
if (isset($form['#enctype'])) {
$enctype = $form['#enctype'];
}
// If some callback set #cache, we need to flip a static flag so later it
// can be found.
if (!empty($form['#cache'])) {
......@@ -948,14 +955,15 @@ function form_builder($form_id, $form, &$form_state) {
$file = TRUE;
}
if (isset($form['#type']) && $form['#type'] == 'form') {
// Set the form encoding if required.
if (isset($enctype)) {
$form['#attributes']['enctype'] = $enctype;
}
// We are on the top form, we can copy back #cache if it's set.
if (isset($cache)) {
$form['#cache'] = TRUE;
}
// If there is a file element, we set the form encoding.
if (isset($file)) {
$form['#attributes']['enctype'] = 'multipart/form-data';
}
}
return $form;
}
......
......@@ -58,7 +58,7 @@ class LocaleTestCase extends DrupalWebTestCase {
// No t() here, we do not want to add this string to the database and it's
// surely not translated yet.
$this->assertText($native, 'Test language added');
$this->drupalGet('logout');
$this->drupalLogout();
// Search for the name and translate it.
$this->drupalLogin($translate_user);
......@@ -90,7 +90,7 @@ class LocaleTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/build/translate/search', $search, t('Search'));
// The indicator should not be here.
$this->assertNoRaw($language_indicator, 'String is translated');
$this->drupalGet('logout');
$this->drupalLogout();
// Delete the language.
$this->drupalLogin($admin_user);
......@@ -104,7 +104,7 @@ class LocaleTestCase extends DrupalWebTestCase {
$this->assertNoText($langcode, 'Language code not found');
$this->assertNoText($name, 'Name not found');
$this->assertNoText($native, 'Native not found');
$this->drupalGet('logout');
$this->drupalLogout();
// Delete the name string.
$this->drupalLogin($translate_user);
......
......@@ -113,7 +113,7 @@ class PollVoteTestCase extends PollTestCase {
$title = $this->randomName();
$choices = $this->_generateChoices(7);
$poll_nid = $this->pollCreate($title, $choices, FALSE);
$this->drupalGet('logout');
$this->drupalLogout();
$web_user = $this->drupalCreateUser(array('cancel own vote', 'inspect all votes', 'vote on polls', 'access content'));
$this->drupalLogin($web_user);
......@@ -130,4 +130,3 @@ class PollVoteTestCase extends PollTestCase {
$this->assertText($choices[0], 'Vote recorded');
}
}
......@@ -661,7 +661,7 @@ function drupalLogin($user = NULL) {
*/
function drupalLogout() {
// Make a request to the logout page.
$this->drupalGet('logout');
$this->drupalGet('user/logout');
// Load the user page, the idea being if you were properly logged out you should be seeing a login screen.
$this->drupalGet('user');
......
......@@ -517,7 +517,6 @@ function system_theme_settings(&$form_state, $key = '') {
}
}
}
$form['#attributes'] = array('enctype' => 'multipart/form-data');
$form = system_settings_form($form);
// We don't want to call system_settings_form_submit(), so change #submit.
......
......@@ -3130,6 +3130,16 @@ function system_update_7013() {
return $ret;
}
/**
* Change the user logout path.
*/
function system_update_7014() {
$ret = array();
$ret[] = update_sql("UPDATE {menu_links} SET link_path = 'user/logout' WHERE link_path = 'logout'");
$ret[] = update_sql("UPDATE {menu_links} SET router_path = 'user/logout' WHERE router_path = 'logout'");
return $ret;
}
/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
......
......@@ -341,6 +341,7 @@ function system_elements() {
$type['file'] = array(
'#input' => TRUE,
'#size' => 60,
'#enctype' => 'multipart/form-data',
);
......
......@@ -258,7 +258,6 @@ function upload_form_alter(&$form, $form_state, $form_id) {
}
else {
$form['attachments']['wrapper'] += _upload_form($node);
$form['#attributes']['enctype'] = 'multipart/form-data';
}
}
$form['#submit'][] = 'upload_node_form_submit';
......
......@@ -977,6 +977,13 @@ function user_menu() {
'type' => MENU_CALLBACK,
);
$items['user/logout'] = array(
'title' => 'Log out',
'access callback' => 'user_is_logged_in',
'page callback' => 'user_logout',
'weight' => 10,
);
// User administration pages.
$items['admin/user'] = array(
'title' => 'User management',
......@@ -1033,13 +1040,6 @@ function user_menu() {
'type' => MENU_CALLBACK,
);
$items['logout'] = array(
'title' => 'Log out',
'access callback' => 'user_is_logged_in',
'page callback' => 'user_logout',
'weight' => 10,
);
$items['user/%user_uid_optional'] = array(
'title' => 'My account',
'title callback' => 'user_page_title',
......@@ -2415,4 +2415,3 @@ function _user_forms(&$edit, $account, $category, $hook = 'form') {
return empty($groups) ? FALSE : $groups;
}
......@@ -246,7 +246,6 @@ function user_profile_form($form_state, $account, $category = 'account') {
'#submit' => array('user_edit_delete_submit'),
);
}
$form['#attributes']['enctype'] = 'multipart/form-data';
return $form;
}
......
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