- Patch #146667 by Jeff Eaton: form API fixes.

6.x
Dries Buytaert 2007-06-04 15:56:34 +00:00
parent f16f70a89e
commit e629deb94d
9 changed files with 22 additions and 22 deletions

View File

@ -1116,7 +1116,7 @@ function comment_delete($cid = NULL) {
return $output;
}
function comment_confirm_delete($comment) {
function comment_confirm_delete(&$form_state, $comment) {
$form = array();
$form['#comment'] = $comment;
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
* them.
*/
function comment_multiple_delete_confirm() {
$edit = $_POST;
function comment_multiple_delete_confirm(&$form_state) {
$edit = $form_state['post'];
$form['comments'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
// 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));
}
function comment_form_add_preview($form, $edit, &$form_state) {
function comment_form_add_preview($form, &$form_state) {
global $user;
$edit = $form_state['values'];
drupal_set_title(t('Preview comment'));
$output = '';
@ -1640,7 +1640,8 @@ function comment_form_add_preview($form, $edit, &$form_state) {
// set any errors.
drupal_validate_form($form['form_id']['#value'], $form, $form_state);
if (!form_get_errors()) {
$comment = (object)_comment_form_submit($edit);
_comment_form_submit($edit);
$comment = (object)$edit;
// Attach the user and time information.
if ($edit['author']) {

View File

@ -259,7 +259,7 @@ function contact_admin_edit_submit($form, &$form_state) {
/**
* 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))) {
$form['category'] = array('#type' => 'value',
'#value' => $info->category,
@ -556,4 +556,3 @@ function contact_mail_page_submit($form, &$form_state) {
$form_state['redirect'] = '';
return;
}

View File

@ -604,7 +604,7 @@ function forum_form_submit($form, &$form_state) {
*
* @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);
$form['tid'] = array('#type' => 'value', '#value' => $tid);

View File

@ -488,7 +488,7 @@ function menu_item_delete_form_submit($form, &$form_state) {
/**
* 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))) {
$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'));

View File

@ -378,7 +378,7 @@ function node_type_reset(&$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['name'] = array('#type' => 'value', '#value' => $type->name);

View File

@ -1673,8 +1673,8 @@ function theme_node_admin_nodes($form) {
return $output;
}
function node_multiple_delete_confirm() {
$edit = $_POST;
function node_multiple_delete_confirm(&$form_state) {
$edit = $form_state['post'];
$form['nodes'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
// 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
*/
function node_delete_confirm($node) {
function node_delete_confirm(&$form_state, $node) {
$form['nid'] = array('#type' => 'value', '#value' => $node->nid);
return confirm_form($form,

View File

@ -389,7 +389,7 @@ function profile_field_form_submit($form, &$form_state) {
/**
* 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));
if (!$field) {
drupal_not_found();

View File

@ -223,7 +223,7 @@ function taxonomy_overview_terms($vocabulary) {
/**
* Display form for adding and editing vocabularies.
*/
function taxonomy_form_vocabulary($edit = array()) {
function taxonomy_form_vocabulary(&$form_state, $edit = array()) {
$edit += array(
'name' => '',
'description' => '',
@ -378,7 +378,7 @@ function taxonomy_del_vocabulary($vid) {
return SAVED_DELETED;
}
function taxonomy_vocabulary_confirm_delete($vid) {
function taxonomy_vocabulary_confirm_delete(&$form_state, $vid) {
$vocabulary = taxonomy_vocabulary_load($vid);
$form['type'] = array('#type' => 'value', '#value' => 'vocabulary');
@ -401,7 +401,7 @@ function taxonomy_vocabulary_confirm_delete_submit($form, &$form_state) {
return;
}
function taxonomy_form_term($vocabulary, $edit = array()) {
function taxonomy_form_term(&$form_state, $vocabulary, $edit = array()) {
$edit += array(
'name' => '',
'description' => '',
@ -614,7 +614,7 @@ function taxonomy_del_term($tid) {
return SAVED_DELETED;
}
function taxonomy_term_confirm_delete($tid) {
function taxonomy_term_confirm_delete(&$form_state, $tid) {
$term = taxonomy_get_term($tid);
$form['type'] = array('#type' => 'value', '#value' => 'term');

View File

@ -1021,7 +1021,7 @@ function user_auth_help_links() {
function user_login($msg = '') {
function user_login(&$form_state, $msg = '') {
global $user;
// 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() {
$edit = $_POST;
function user_multiple_delete_confirm(&$form_state) {
$edit = $form_state['post'];
$form['accounts'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
// array_filter returns only elements with TRUE values