Commit 26bd4498 authored by Dries's avatar Dries

- Patch #39576 by chx: rename '_execute' to '_submit' and '#execute' to '#submit'.

parent 4a3b9fc8
......@@ -41,7 +41,7 @@ function element_children($element) {
* Processes a form array, and produces the HTML output of a form.
* If there is input in the $_POST['edit'] variable, this function
* will attempt to validate it, using <code>drupal_validate_form</code>,
* and then execute the form using <code>drupal_execute_form</code>.
* and then submit the form using <code>drupal_submit_form</code>.
*
* @param $form_id
* A unique string identifying the form. Allows each form to be themed.
......@@ -79,12 +79,12 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
}
}
if (!isset($form['#execute'])) {
if (function_exists($form_id .'_execute')) {
$form['#execute'] = array($form_id .'_execute');
if (!isset($form['#submit'])) {
if (function_exists($form_id .'_submit')) {
$form['#submit'] = array($form_id .'_submit');
}
elseif (function_exists($callback .'_execute')) {
$form['#execute'] = array($callback .'_execute');
elseif (function_exists($callback .'_submit')) {
$form['#submit'] = array($callback .'_submit');
}
}
......@@ -98,7 +98,7 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
if (!empty($_POST['edit']) && (($_POST['edit']['form_id'] == $form_id) || ($_POST['edit']['form_id'] == $callback))) {
drupal_validate_form($form_id, $form, $callback);
if ($form_submitted && !form_get_errors()) {
drupal_execute_form($form_id, $form, $callback);
drupal_submit_form($form_id, $form, $callback);
}
}
......@@ -136,11 +136,11 @@ function drupal_validate_form($form_id, &$form, $callback = NULL) {
}
}
function drupal_execute_form($form_id, $form, $callback = NULL) {
function drupal_submit_form($form_id, $form, $callback = NULL) {
global $form_values;
if (isset($form['#execute'])) {
foreach ($form['#execute'] as $key => $function) {
if (isset($form['#submit'])) {
foreach ($form['#submit'] as $key => $function) {
if (isset($form['#execution_arguments'][$key])) {
$function_args = array_merge(array($form_id, $form_values), $form['#execution_arguments'][$key]);
call_user_func_array($function, $function_args);
......
......@@ -1001,7 +1001,7 @@ function aggregator_page_list_validate($form_id, &$form) {
}
}
function aggregator_page_list_execute($form_id, $form) {
function aggregator_page_list_submit($form_id, $form) {
global $form_values;
foreach ($form_values['categories'] as $iid => $selection) {
db_query('DELETE FROM {aggregator_category_item} WHERE iid = %d', $iid);
......
......@@ -1001,7 +1001,7 @@ function aggregator_page_list_validate($form_id, &$form) {
}
}
function aggregator_page_list_execute($form_id, $form) {
function aggregator_page_list_submit($form_id, $form) {
global $form_values;
foreach ($form_values['categories'] as $iid => $selection) {
db_query('DELETE FROM {aggregator_category_item} WHERE iid = %d', $iid);
......
......@@ -387,7 +387,7 @@ function block_admin_configure_validate($form_id, $form_values) {
}
}
function block_admin_configure_execute($form_id, $form_values) {
function block_admin_configure_submit($form_id, $form_values) {
if (!form_get_errors()) {
db_query("UPDATE {blocks} SET visibility = %d, pages = '%s', custom = %d WHERE module = '%s' AND delta = '%s'", $form_values['visibility'], $form_values['pages'], $form_values['custom'], $form_values['module'], $form_values['delta']);
module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values);
......@@ -413,7 +413,7 @@ function block_box_add_validate($form_id, $form_values) {
}
}
function block_box_add_execute($form_id, $form_values) {
function block_box_add_submit($form_id, $form_values) {
if (!form_get_errors()) {
if (block_box_save($form_values)) {
drupal_set_message(t('The block has been created.'));
......@@ -436,7 +436,7 @@ function block_box_delete($bid = 0) {
/**
* Deletion of custom blocks.
*/
function block_box_delete_confirm_execute($form_id, $form_values) {
function block_box_delete_confirm_submit($form_id, $form_values) {
db_query('DELETE FROM {boxes} WHERE bid = %d', $form_values['bid']);
drupal_set_message(t('The block %name has been removed.', array('%name' => theme('placeholder', $form_values['info']))));
cache_clear_all();
......
......@@ -387,7 +387,7 @@ function block_admin_configure_validate($form_id, $form_values) {
}
}
function block_admin_configure_execute($form_id, $form_values) {
function block_admin_configure_submit($form_id, $form_values) {
if (!form_get_errors()) {
db_query("UPDATE {blocks} SET visibility = %d, pages = '%s', custom = %d WHERE module = '%s' AND delta = '%s'", $form_values['visibility'], $form_values['pages'], $form_values['custom'], $form_values['module'], $form_values['delta']);
module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values);
......@@ -413,7 +413,7 @@ function block_box_add_validate($form_id, $form_values) {
}
}
function block_box_add_execute($form_id, $form_values) {
function block_box_add_submit($form_id, $form_values) {
if (!form_get_errors()) {
if (block_box_save($form_values)) {
drupal_set_message(t('The block has been created.'));
......@@ -436,7 +436,7 @@ function block_box_delete($bid = 0) {
/**
* Deletion of custom blocks.
*/
function block_box_delete_confirm_execute($form_id, $form_values) {
function block_box_delete_confirm_submit($form_id, $form_values) {
db_query('DELETE FROM {boxes} WHERE bid = %d', $form_values['bid']);
drupal_set_message(t('The block %name has been removed.', array('%name' => theme('placeholder', $form_values['info']))));
cache_clear_all();
......
......@@ -225,9 +225,9 @@ function book_delete(&$node) {
}
/**
* Implementation of hook_execute().
* Implementation of hook_submit().
*/
function book_execute(&$node) {
function book_submit(&$node) {
// Set default values for non-administrators.
if (!user_access('administer nodes')) {
$node->weight = 0;
......@@ -968,7 +968,7 @@ function book_admin_orphan() {
}
}
function book_admin_edit_execute($form_id, $form_values) {
function book_admin_edit_submit($form_id, $form_values) {
foreach ($form_values['table'] as $row) {
$node = node_load($row['nid']);
......
......@@ -225,9 +225,9 @@ function book_delete(&$node) {
}
/**
* Implementation of hook_execute().
* Implementation of hook_submit().
*/
function book_execute(&$node) {
function book_submit(&$node) {
// Set default values for non-administrators.
if (!user_access('administer nodes')) {
$node->weight = 0;
......@@ -968,7 +968,7 @@ function book_admin_orphan() {
}
}
function book_admin_edit_execute($form_id, $form_values) {
function book_admin_edit_submit($form_id, $form_values) {
foreach ($form_values['table'] as $row) {
$node = node_load($row['nid']);
......
......@@ -1232,7 +1232,7 @@ function comment_form_validate($form_id, $form_values) {
comment_validate($form_values);
}
function comment_form_execute($form_id, $form_values) {
function comment_form_submit($form_id, $form_values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
$nid = $form_values['nid'];
......@@ -1328,7 +1328,7 @@ function theme_comment_controls($form) {
return theme('box', t('Comment viewing options'), $output);
}
function comment_controls_execute($form_id, $form_values) {
function comment_controls_submit($form_id, $form_values) {
global $user;
$mode = $form_values['mode'];
......
......@@ -1232,7 +1232,7 @@ function comment_form_validate($form_id, $form_values) {
comment_validate($form_values);
}
function comment_form_execute($form_id, $form_values) {
function comment_form_submit($form_id, $form_values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
$nid = $form_values['nid'];
......@@ -1328,7 +1328,7 @@ function theme_comment_controls($form) {
return theme('box', t('Comment viewing options'), $output);
}
function comment_controls_execute($form_id, $form_values) {
function comment_controls_submit($form_id, $form_values) {
global $user;
$mode = $form_values['mode'];
......
......@@ -129,7 +129,7 @@ function contact_mail_user() {
}
}
function contact_user_mail_execute($form_id, $edit) {
function contact_user_mail_submit($form_id, $edit) {
global $user;
$account = user_load(array('uid' => arg(1), 'status' => 1));
......@@ -297,7 +297,7 @@ function contact_mail_page_validate($form_id, &$form) {
}
}
function contact_mail_page_execute($form_id, $edit) {
function contact_mail_page_submit($form_id, $edit) {
// Prepare the sender:
$from = $edit['mail'];
......
......@@ -129,7 +129,7 @@ function contact_mail_user() {
}
}
function contact_user_mail_execute($form_id, $edit) {
function contact_user_mail_submit($form_id, $edit) {
global $user;
$account = user_load(array('uid' => arg(1), 'status' => 1));
......@@ -297,7 +297,7 @@ function contact_mail_page_validate($form_id, &$form) {
}
}
function contact_mail_page_execute($form_id, $edit) {
function contact_mail_page_submit($form_id, $edit) {
// Prepare the sender:
$from = $edit['mail'];
......
......@@ -506,12 +506,12 @@ function forum_view(&$node, $teaser = FALSE, $page = FALSE) {
}
/**
* Implementation of hook_execute().
* Implementation of hook_submit().
*
* Check in particular that only a "leaf" term in the associated taxonomy
* vocabulary is selected, not a "container" term.
*/
function forum_execute(&$node) {
function forum_submit(&$node) {
// Make sure all fields are set properly:
$node->icon = $node->icon ? $node->icon : '';
......
......@@ -506,12 +506,12 @@ function forum_view(&$node, $teaser = FALSE, $page = FALSE) {
}
/**
* Implementation of hook_execute().
* Implementation of hook_submit().
*
* Check in particular that only a "leaf" term in the associated taxonomy
* vocabulary is selected, not a "container" term.
*/
function forum_execute(&$node) {
function forum_submit(&$node) {
// Make sure all fields are set properly:
$node->icon = $node->icon ? $node->icon : '';
......
......@@ -1065,7 +1065,7 @@ function theme_node_filters(&$form) {
}
function node_filter_form_execute() {
function node_filter_form_submit() {
global $form_values;
$op = $_POST['op'];
$filters = node_filters();
......@@ -1095,7 +1095,7 @@ function node_filter_form_execute() {
/**
* Generate the content administration overview.
*/
function node_admin_nodes_execute($form_id, $edit) {
function node_admin_nodes_submit($form_id, $edit) {
$operations = node_operations();
if ($operations[$edit['operation']][1]) {
// Flag changes
......@@ -1212,7 +1212,7 @@ function node_multiple_delete_confirm() {
}
function node_multiple_delete_confirm_execute($form_id, $edit) {
function node_multiple_delete_confirm_submit($form_id, $edit) {
if ($edit['confirm']) {
foreach ($edit['nodes'] as $nid => $value) {
node_delete($nid);
......@@ -1469,7 +1469,7 @@ function node_feed($nodes = 0, $channel = array()) {
/**
* Prepare node for save and allow modules to make changes.
*/
function node_execute($node) {
function node_submit($node) {
global $user;
// Convert the node to an object, if necessary.
......@@ -1820,11 +1820,11 @@ function theme_node_preview($node) {
return $output;
}
function node_form_execute($form_id, $edit) {
function node_form_submit($form_id, $edit) {
global $user;
// Fix up the node when required:
$node = node_execute($edit);
$node = node_submit($edit);
// Prepare the node's body:
if ($node->nid) {
......@@ -1877,7 +1877,7 @@ function node_delete_confirm() {
/**
* Execute node deletion
*/
function node_delete_confirm_execute($form_id, $form_values) {
function node_delete_confirm_submit($form_id, $form_values) {
if ($form_values['confirm']) {
node_delete($form_values['nid']);
drupal_goto('node');
......
......@@ -1065,7 +1065,7 @@ function theme_node_filters(&$form) {
}
function node_filter_form_execute() {
function node_filter_form_submit() {
global $form_values;
$op = $_POST['op'];
$filters = node_filters();
......@@ -1095,7 +1095,7 @@ function node_filter_form_execute() {
/**
* Generate the content administration overview.
*/
function node_admin_nodes_execute($form_id, $edit) {
function node_admin_nodes_submit($form_id, $edit) {
$operations = node_operations();
if ($operations[$edit['operation']][1]) {
// Flag changes
......@@ -1212,7 +1212,7 @@ function node_multiple_delete_confirm() {
}
function node_multiple_delete_confirm_execute($form_id, $edit) {
function node_multiple_delete_confirm_submit($form_id, $edit) {
if ($edit['confirm']) {
foreach ($edit['nodes'] as $nid => $value) {
node_delete($nid);
......@@ -1469,7 +1469,7 @@ function node_feed($nodes = 0, $channel = array()) {
/**
* Prepare node for save and allow modules to make changes.
*/
function node_execute($node) {
function node_submit($node) {
global $user;
// Convert the node to an object, if necessary.
......@@ -1820,11 +1820,11 @@ function theme_node_preview($node) {
return $output;
}
function node_form_execute($form_id, $edit) {
function node_form_submit($form_id, $edit) {
global $user;
// Fix up the node when required:
$node = node_execute($edit);
$node = node_submit($edit);
// Prepare the node's body:
if ($node->nid) {
......@@ -1877,7 +1877,7 @@ function node_delete_confirm() {
/**
* Execute node deletion
*/
function node_delete_confirm_execute($form_id, $form_values) {
function node_delete_confirm_submit($form_id, $form_values) {
if ($form_values['confirm']) {
node_delete($form_values['nid']);
drupal_goto('node');
......
......@@ -267,7 +267,7 @@ function path_load($pid) {
/**
* Verify that a new URL alias is valid, and save it to the database.
*/
function path_form_execute() {
function path_form_submit() {
$edit = $GLOBALS['form_values'];
$src = $edit['src'];
$dst = $edit['dst'];
......
......@@ -267,7 +267,7 @@ function path_load($pid) {
/**
* Verify that a new URL alias is valid, and save it to the database.
*/
function path_form_execute() {
function path_form_submit() {
$edit = $GLOBALS['form_values'];
$src = $edit['src'];
$dst = $edit['dst'];
......
......@@ -90,9 +90,9 @@ function poll_delete($node) {
}
/**
* Implementation of hook_execute().
* Implementation of hook_submit().
*/
function poll_execute(&$node) {
function poll_submit(&$node) {
// Renumber fields
$node->choice = array_values($node->choice);
$node->teaser = poll_teaser($node);
......
......@@ -90,9 +90,9 @@ function poll_delete($node) {
}
/**
* Implementation of hook_execute().
* Implementation of hook_submit().
*/
function poll_execute(&$node) {
function poll_submit(&$node) {
// Renumber fields
$node->choice = array_values($node->choice);
$node->teaser = poll_teaser($node);
......
......@@ -243,7 +243,7 @@ function search_wipe_confirm() {
/**
* Handler for wipe confirmation
*/
function search_wipe_confirm_execute($form_id, &$form) {
function search_wipe_confirm_submit($form_id, &$form) {
if ($form['confirm']) {
search_wipe();
drupal_set_message(t('The index will be rebuilt.'));
......
......@@ -243,7 +243,7 @@ function search_wipe_confirm() {
/**
* Handler for wipe confirmation
*/
function search_wipe_confirm_execute($form_id, &$form) {
function search_wipe_confirm_submit($form_id, &$form) {
if ($form['confirm']) {
search_wipe();
drupal_set_message(t('The index will be rebuilt.'));
......
......@@ -704,7 +704,7 @@ function system_settings_form($form_id, $form) {
return drupal_get_form($form_id, $form, 'system_settings_form');
}
function system_theme_settings_execute($form_id, $values) {
function system_theme_settings_submit($form_id, $values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
$key = $values['var'];
......@@ -729,7 +729,7 @@ function system_theme_settings_execute($form_id, $values) {
* add an array_filter value to your form.
*
*/
function system_settings_form_execute($form_id, $values) {
function system_settings_form_submit($form_id, $values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
foreach ($values as $key => $value) {
......@@ -822,7 +822,7 @@ function theme_system_themes($form) {
}
function system_themes_execute($form_id, $values) {
function system_themes_submit($form_id, $values) {
db_query("UPDATE {system} SET status = 0 WHERE type = 'theme'");
......@@ -941,7 +941,7 @@ function theme_system_modules($form) {
}
function system_modules_execute($form_id, $edit) {
function system_modules_submit($form_id, $edit) {
db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module'");
foreach ($edit['status'] as $key => $choice) {
......
......@@ -704,7 +704,7 @@ function system_settings_form($form_id, $form) {
return drupal_get_form($form_id, $form, 'system_settings_form');
}
function system_theme_settings_execute($form_id, $values) {
function system_theme_settings_submit($form_id, $values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
$key = $values['var'];
......@@ -729,7 +729,7 @@ function system_theme_settings_execute($form_id, $values) {
* add an array_filter value to your form.
*
*/
function system_settings_form_execute($form_id, $values) {
function system_settings_form_submit($form_id, $values) {
$op = isset($_POST['op']) ? $_POST['op'] : '';
foreach ($values as $key => $value) {
......@@ -822,7 +822,7 @@ function theme_system_themes($form) {
}
function system_themes_execute($form_id, $values) {
function system_themes_submit($form_id, $values) {
db_query("UPDATE {system} SET status = 0 WHERE type = 'theme'");
......@@ -941,7 +941,7 @@ function theme_system_modules($form) {
}
function system_modules_execute($form_id, $edit) {
function system_modules_submit($form_id, $edit) {
db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module'");
foreach ($edit['status'] as $key => $choice) {
......
......@@ -872,7 +872,7 @@ function user_login_validate($form_id, $form_values) {
}
}
function user_login_execute($form_id, $form_values) {
function user_login_submit($form_id, $form_values) {
global $user;
if ($user->uid) {
watchdog('user', t('Session opened for %name.', array('%name' => theme('placeholder', $user->name))));
......@@ -979,7 +979,7 @@ function user_pass_validate() {
}
}
function user_pass_execute($form_id, $form_values) {
function user_pass_submit($form_id, $form_values) {
global $base_url;
$account = $form_values['account'];
......@@ -1099,7 +1099,7 @@ function user_register_validate($form_id, $form_values) {
user_module_invoke('validate', $form_values, $form_values, 'account');
}
function user_register_execute($form_id, $form_values) {
function user_register_submit($form_id, $form_values) {
global $base_url;
$admin = user_access('administer users');
......@@ -1455,7 +1455,7 @@ function user_admin_access_delete($aid = 0) {
return $output;
}
function user_admin_access_delete_confirm_execute($form_id, $edit) {
function user_admin_access_delete_confirm_submit($form_id, $edit) {
db_query('DELETE FROM {access} WHERE aid = %d', $edit['aid']);
drupal_set_message(t('The access rule has been deleted.'));
drupal_goto('admin/access/rules');
......@@ -1624,7 +1624,7 @@ function theme_user_admin_perm($form) {
return $output;
}
function user_admin_perm_execute($form_id, $edit) {
function user_admin_perm_submit($form_id, $edit) {
// Save permissions:
$result = db_query('SELECT * FROM {role}');
while ($role = db_fetch_object($result)) {
......
......@@ -872,7 +872,7 @@ function user_login_validate($form_id, $form_values) {
}
}
function user_login_execute($form_id, $form_values) {
function user_login_submit($form_id, $form_values) {
global $user;
if ($user->uid) {
watchdog('user', t('Session opened for %name.', array('%name' => theme('placeholder', $user->name))));
......@@ -979,7 +979,7 @@ function user_pass_validate() {
}
}
function user_pass_execute($form_id, $form_values) {
function user_pass_submit($form_id, $form_values) {
global $base_url;
$account = $form_values['account'];
......@@ -1099,7 +1099,7 @@ function user_register_validate($form_id, $form_values) {
user_module_invoke('validate', $form_values, $form_values, 'account');
}
function user_register_execute($form_id, $form_values) {
function user_register_submit($form_id, $form_values) {
global $base_url;
$admin = user_access('administer users');
......@@ -1455,7 +1455,7 @@ function user_admin_access_delete($aid = 0) {
return $output;
}
function user_admin_access_delete_confirm_execute($form_id, $edit) {
function user_admin_access_delete_confirm_submit($form_id, $edit) {
db_query('DELETE FROM {access} WHERE aid = %d', $edit['aid']);
drupal_set_message(t('The access rule has been deleted.'));
drupal_goto('admin/access/rules');
......@@ -1624,7 +1624,7 @@ function theme_user_admin_perm($form) {
return $output;
}
function user_admin_perm_execute($form_id, $edit) {
function user_admin_perm_submit($form_id, $edit) {
// Save permissions:
$result = db_query('SELECT * FROM {role}');
while ($role = db_fetch_object($result)) {
......
......@@ -138,7 +138,7 @@ function theme_watchdog_form_overview($form) {
return '<div class="container-inline">'. form_render($form) .'</div>';
}
function watchdog_form_overview_execute($form_id, $form) {
function watchdog_form_overview_submit($form_id, $form) {
global $form_values;
$_SESSION['watchdog_overview_filter'] = $form_values['filter'];
}
......
......@@ -138,7 +138,7 @@ function theme_watchdog_form_overview($form) {
return '<div class="container-inline">'. form_render($form) .'</div>';
}
function watchdog_form_overview_execute($form_id, $form) {
function watchdog_form_overview_submit($form_id, $form) {
global $form_values;
$_SESSION['watchdog_overview_filter'] = $form_values['filter'];
}
......
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