- Patch #146667 by Jeff Eaton: form API fixes.
parent
f16f70a89e
commit
e629deb94d
|
@ -1116,7 +1116,7 @@ function comment_delete($cid = NULL) {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function comment_confirm_delete($comment) {
|
function comment_confirm_delete(&$form_state, $comment) {
|
||||||
$form = array();
|
$form = array();
|
||||||
$form['#comment'] = $comment;
|
$form['#comment'] = $comment;
|
||||||
return confirm_form(
|
return confirm_form(
|
||||||
|
@ -1295,8 +1295,8 @@ function theme_comment_admin_overview($form) {
|
||||||
* List the selected comments and verify that the admin really wants to delete
|
* List the selected comments and verify that the admin really wants to delete
|
||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
function comment_multiple_delete_confirm() {
|
function comment_multiple_delete_confirm(&$form_state) {
|
||||||
$edit = $_POST;
|
$edit = $form_state['post'];
|
||||||
|
|
||||||
$form['comments'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
|
$form['comments'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
|
||||||
// array_filter() returns only elements with actual values
|
// array_filter() returns only elements with actual values
|
||||||
|
@ -1627,9 +1627,9 @@ function comment_form_box($edit, $title = NULL) {
|
||||||
return theme('box', $title, drupal_get_form('comment_form', $edit, $title));
|
return theme('box', $title, drupal_get_form('comment_form', $edit, $title));
|
||||||
}
|
}
|
||||||
|
|
||||||
function comment_form_add_preview($form, $edit, &$form_state) {
|
function comment_form_add_preview($form, &$form_state) {
|
||||||
global $user;
|
global $user;
|
||||||
|
$edit = $form_state['values'];
|
||||||
drupal_set_title(t('Preview comment'));
|
drupal_set_title(t('Preview comment'));
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
@ -1640,7 +1640,8 @@ function comment_form_add_preview($form, $edit, &$form_state) {
|
||||||
// set any errors.
|
// set any errors.
|
||||||
drupal_validate_form($form['form_id']['#value'], $form, $form_state);
|
drupal_validate_form($form['form_id']['#value'], $form, $form_state);
|
||||||
if (!form_get_errors()) {
|
if (!form_get_errors()) {
|
||||||
$comment = (object)_comment_form_submit($edit);
|
_comment_form_submit($edit);
|
||||||
|
$comment = (object)$edit;
|
||||||
|
|
||||||
// Attach the user and time information.
|
// Attach the user and time information.
|
||||||
if ($edit['author']) {
|
if ($edit['author']) {
|
||||||
|
|
|
@ -259,7 +259,7 @@ function contact_admin_edit_submit($form, &$form_state) {
|
||||||
/**
|
/**
|
||||||
* Category delete page.
|
* Category delete page.
|
||||||
*/
|
*/
|
||||||
function contact_admin_delete($cid = NULL) {
|
function contact_admin_delete(&$form_state, $cid = NULL) {
|
||||||
if ($info = db_fetch_object(db_query("SELECT category FROM {contact} WHERE cid = %d", $cid))) {
|
if ($info = db_fetch_object(db_query("SELECT category FROM {contact} WHERE cid = %d", $cid))) {
|
||||||
$form['category'] = array('#type' => 'value',
|
$form['category'] = array('#type' => 'value',
|
||||||
'#value' => $info->category,
|
'#value' => $info->category,
|
||||||
|
@ -556,4 +556,3 @@ function contact_mail_page_submit($form, &$form_state) {
|
||||||
$form_state['redirect'] = '';
|
$form_state['redirect'] = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -604,7 +604,7 @@ function forum_form_submit($form, &$form_state) {
|
||||||
*
|
*
|
||||||
* @param $tid ID of the term to be deleted
|
* @param $tid ID of the term to be deleted
|
||||||
*/
|
*/
|
||||||
function forum_confirm_delete($tid) {
|
function forum_confirm_delete(&$form_state, $tid) {
|
||||||
$term = taxonomy_get_term($tid);
|
$term = taxonomy_get_term($tid);
|
||||||
|
|
||||||
$form['tid'] = array('#type' => 'value', '#value' => $tid);
|
$form['tid'] = array('#type' => 'value', '#value' => $tid);
|
||||||
|
|
|
@ -488,7 +488,7 @@ function menu_item_delete_form_submit($form, &$form_state) {
|
||||||
/**
|
/**
|
||||||
* Menu callback; reset a single modified item.
|
* Menu callback; reset a single modified item.
|
||||||
*/
|
*/
|
||||||
function menu_reset_item($mid) {
|
function menu_reset_item(&$form_state, $mid) {
|
||||||
if (isset($mid) && $item = db_fetch_object(db_query('SELECT path, title FROM {menu} WHERE mid = %d', $mid))) {
|
if (isset($mid) && $item = db_fetch_object(db_query('SELECT path, title FROM {menu} WHERE mid = %d', $mid))) {
|
||||||
$form['mid'] = array('#type' => 'value', '#value' => $item->path);
|
$form['mid'] = array('#type' => 'value', '#value' => $item->path);
|
||||||
return confirm_form($form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => $item->title)), 'admin/build/menu', t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
|
return confirm_form($form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => $item->title)), 'admin/build/menu', t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
|
||||||
|
|
|
@ -378,7 +378,7 @@ function node_type_reset(&$type) {
|
||||||
/**
|
/**
|
||||||
* Menu callback; delete a single content type.
|
* Menu callback; delete a single content type.
|
||||||
*/
|
*/
|
||||||
function node_type_delete_confirm($type) {
|
function node_type_delete_confirm(&$form_state, $type) {
|
||||||
$form['type'] = array('#type' => 'value', '#value' => $type->type);
|
$form['type'] = array('#type' => 'value', '#value' => $type->type);
|
||||||
$form['name'] = array('#type' => 'value', '#value' => $type->name);
|
$form['name'] = array('#type' => 'value', '#value' => $type->name);
|
||||||
|
|
||||||
|
|
|
@ -1673,8 +1673,8 @@ function theme_node_admin_nodes($form) {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function node_multiple_delete_confirm() {
|
function node_multiple_delete_confirm(&$form_state) {
|
||||||
$edit = $_POST;
|
$edit = $form_state['post'];
|
||||||
|
|
||||||
$form['nodes'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
|
$form['nodes'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
|
||||||
// array_filter returns only elements with TRUE values
|
// array_filter returns only elements with TRUE values
|
||||||
|
@ -2359,7 +2359,7 @@ function node_form_submit($form, &$form_state) {
|
||||||
/**
|
/**
|
||||||
* Menu callback -- ask for confirmation of node deletion
|
* Menu callback -- ask for confirmation of node deletion
|
||||||
*/
|
*/
|
||||||
function node_delete_confirm($node) {
|
function node_delete_confirm(&$form_state, $node) {
|
||||||
$form['nid'] = array('#type' => 'value', '#value' => $node->nid);
|
$form['nid'] = array('#type' => 'value', '#value' => $node->nid);
|
||||||
|
|
||||||
return confirm_form($form,
|
return confirm_form($form,
|
||||||
|
|
|
@ -389,7 +389,7 @@ function profile_field_form_submit($form, &$form_state) {
|
||||||
/**
|
/**
|
||||||
* Menu callback; deletes a field from all user profiles.
|
* Menu callback; deletes a field from all user profiles.
|
||||||
*/
|
*/
|
||||||
function profile_field_delete($fid) {
|
function profile_field_delete(&$form_state, $fid) {
|
||||||
$field = db_fetch_object(db_query("SELECT title FROM {profile_fields} WHERE fid = %d", $fid));
|
$field = db_fetch_object(db_query("SELECT title FROM {profile_fields} WHERE fid = %d", $fid));
|
||||||
if (!$field) {
|
if (!$field) {
|
||||||
drupal_not_found();
|
drupal_not_found();
|
||||||
|
|
|
@ -223,7 +223,7 @@ function taxonomy_overview_terms($vocabulary) {
|
||||||
/**
|
/**
|
||||||
* Display form for adding and editing vocabularies.
|
* Display form for adding and editing vocabularies.
|
||||||
*/
|
*/
|
||||||
function taxonomy_form_vocabulary($edit = array()) {
|
function taxonomy_form_vocabulary(&$form_state, $edit = array()) {
|
||||||
$edit += array(
|
$edit += array(
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
|
@ -378,7 +378,7 @@ function taxonomy_del_vocabulary($vid) {
|
||||||
return SAVED_DELETED;
|
return SAVED_DELETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
function taxonomy_vocabulary_confirm_delete($vid) {
|
function taxonomy_vocabulary_confirm_delete(&$form_state, $vid) {
|
||||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||||
|
|
||||||
$form['type'] = array('#type' => 'value', '#value' => 'vocabulary');
|
$form['type'] = array('#type' => 'value', '#value' => 'vocabulary');
|
||||||
|
@ -401,7 +401,7 @@ function taxonomy_vocabulary_confirm_delete_submit($form, &$form_state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function taxonomy_form_term($vocabulary, $edit = array()) {
|
function taxonomy_form_term(&$form_state, $vocabulary, $edit = array()) {
|
||||||
$edit += array(
|
$edit += array(
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
|
@ -614,7 +614,7 @@ function taxonomy_del_term($tid) {
|
||||||
return SAVED_DELETED;
|
return SAVED_DELETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
function taxonomy_term_confirm_delete($tid) {
|
function taxonomy_term_confirm_delete(&$form_state, $tid) {
|
||||||
$term = taxonomy_get_term($tid);
|
$term = taxonomy_get_term($tid);
|
||||||
|
|
||||||
$form['type'] = array('#type' => 'value', '#value' => 'term');
|
$form['type'] = array('#type' => 'value', '#value' => 'term');
|
||||||
|
|
|
@ -1021,7 +1021,7 @@ function user_auth_help_links() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function user_login($msg = '') {
|
function user_login(&$form_state, $msg = '') {
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
// If we are already logged on, go to the user page instead.
|
// If we are already logged on, go to the user page instead.
|
||||||
|
@ -2408,8 +2408,8 @@ function user_multiple_role_edit($accounts, $operation, $rid) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function user_multiple_delete_confirm() {
|
function user_multiple_delete_confirm(&$form_state) {
|
||||||
$edit = $_POST;
|
$edit = $form_state['post'];
|
||||||
|
|
||||||
$form['accounts'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
|
$form['accounts'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
|
||||||
// array_filter returns only elements with TRUE values
|
// array_filter returns only elements with TRUE values
|
||||||
|
|
Loading…
Reference in New Issue