Issue #1049462 by rfay: Fixed Usage of deprecated form_state['clicked_button'] causes bugs during AJAX submissions by non-buttons.
parent
97fe7df1cb
commit
c0bfd275c2
|
@ -193,7 +193,7 @@ function _authorize_filetransfer_connection_settings_set_defaults(&$element, $ke
|
|||
function authorize_filetransfer_form_validate($form, &$form_state) {
|
||||
// Only validate the form if we have collected all of the user input and are
|
||||
// ready to proceed with updating or installing.
|
||||
if ($form_state['clicked_button']['#name'] != 'process_updates') {
|
||||
if ($form_state['triggering_element']['#name'] != 'process_updates') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ function authorize_filetransfer_form_validate($form, &$form_state) {
|
|||
*/
|
||||
function authorize_filetransfer_form_submit($form, &$form_state) {
|
||||
global $base_url;
|
||||
switch ($form_state['clicked_button']['#name']) {
|
||||
switch ($form_state['triggering_element']['#name']) {
|
||||
case 'process_updates':
|
||||
|
||||
// Save the connection settings to the DB.
|
||||
|
|
|
@ -373,7 +373,7 @@ function field_default_form_errors($entity_type, $entity, $field, $instance, $la
|
|||
* to return just the changed part of the form.
|
||||
*/
|
||||
function field_add_more_submit($form, &$form_state) {
|
||||
$button = $form_state['clicked_button'];
|
||||
$button = $form_state['triggering_element'];
|
||||
|
||||
// Go one level up in the form, to the widgets container.
|
||||
$element = drupal_array_get_nested_value($form, array_slice($button['#array_parents'], 0, -1));
|
||||
|
@ -398,7 +398,7 @@ function field_add_more_submit($form, &$form_state) {
|
|||
* @see field_add_more_submit()
|
||||
*/
|
||||
function field_add_more_js($form, $form_state) {
|
||||
$button = $form_state['clicked_button'];
|
||||
$button = $form_state['triggering_element'];
|
||||
|
||||
// Go one level up in the form, to the widgets container.
|
||||
$element = drupal_array_get_nested_value($form, array_slice($button['#array_parents'], 0, -1));
|
||||
|
|
|
@ -352,7 +352,7 @@ function field_ui_form_node_type_form_alter(&$form, $form_state) {
|
|||
* Redirect to manage fields form.
|
||||
*/
|
||||
function field_ui_form_node_type_form_submit($form, &$form_state) {
|
||||
if ($form_state['clicked_button']['#parents'][0] === 'save_continue') {
|
||||
if ($form_state['triggering_element']['#parents'][0] === 'save_continue') {
|
||||
$form_state['redirect'] = _field_ui_bundle_admin_path('node', $form_state['values']['type']) .'/fields';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -533,7 +533,7 @@ function file_managed_file_validate(&$element, &$form_state) {
|
|||
// If referencing an existing file, only allow if there are existing
|
||||
// references. This prevents unmanaged files from being deleted if this
|
||||
// item were to be deleted.
|
||||
$clicked_button = end($form_state['clicked_button']['#parents']);
|
||||
$clicked_button = end($form_state['triggering_element']['#parents']);
|
||||
if ($clicked_button != 'remove_button' && !empty($element['fid']['#value'])) {
|
||||
if ($file = file_load($element['fid']['#value'])) {
|
||||
if ($file->status == FILE_STATUS_PERMANENT) {
|
||||
|
|
|
@ -143,7 +143,7 @@ function search_admin_settings($form) {
|
|||
*/
|
||||
function search_admin_settings_validate($form, &$form_state) {
|
||||
// Check whether we selected a valid default.
|
||||
if ($form_state['clicked_button']['#value'] != t('Reset to defaults')) {
|
||||
if ($form_state['triggering_element']['#value'] != t('Reset to defaults')) {
|
||||
$new_modules = array_filter($form_state['values']['search_active_modules']);
|
||||
$default = $form_state['values']['search_default_module'];
|
||||
if (!in_array($default, $new_modules, TRUE)) {
|
||||
|
@ -164,7 +164,7 @@ function search_admin_settings_submit($form, &$form_state) {
|
|||
}
|
||||
$current_modules = variable_get('search_active_modules', array('node', 'user'));
|
||||
// Check whether we are resetting the values.
|
||||
if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {
|
||||
if ($form_state['triggering_element']['#value'] == t('Reset to defaults')) {
|
||||
$new_modules = array('node', 'user');
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -209,7 +209,7 @@ function taxonomy_form_vocabulary_validate($form, &$form_state) {
|
|||
* @see taxonomy_form_vocabulary_validate()
|
||||
*/
|
||||
function taxonomy_form_vocabulary_submit($form, &$form_state) {
|
||||
if ($form_state['clicked_button']['#value'] == t('Delete')) {
|
||||
if ($form_state['triggering_element']['#value'] == t('Delete')) {
|
||||
// Rebuild the form to confirm vocabulary deletion.
|
||||
$form_state['rebuild'] = TRUE;
|
||||
$form_state['confirm_delete'] = TRUE;
|
||||
|
@ -434,7 +434,7 @@ function taxonomy_overview_terms($form, &$form_state, $vocabulary) {
|
|||
* @see taxonomy_overview_terms()
|
||||
*/
|
||||
function taxonomy_overview_terms_submit($form, &$form_state) {
|
||||
if ($form_state['clicked_button']['#value'] == t('Reset to alphabetical')) {
|
||||
if ($form_state['triggering_element']['#value'] == t('Reset to alphabetical')) {
|
||||
// Execute the reset action.
|
||||
if ($form_state['values']['reset_alphabetical'] === TRUE) {
|
||||
return taxonomy_vocabulary_confirm_reset_alphabetical_submit($form, $form_state);
|
||||
|
@ -801,7 +801,7 @@ function taxonomy_form_term_validate($form, &$form_state) {
|
|||
* @see taxonomy_form_term()
|
||||
*/
|
||||
function taxonomy_form_term_submit($form, &$form_state) {
|
||||
if ($form_state['clicked_button']['#value'] == t('Delete')) {
|
||||
if ($form_state['triggering_element']['#value'] == t('Delete')) {
|
||||
// Execute the term deletion.
|
||||
if ($form_state['values']['delete'] === TRUE) {
|
||||
return taxonomy_term_confirm_delete_submit($form, $form_state);
|
||||
|
@ -812,7 +812,7 @@ function taxonomy_form_term_submit($form, &$form_state) {
|
|||
return;
|
||||
}
|
||||
// Rebuild the form to confirm enabling multiple parents.
|
||||
elseif ($form_state['clicked_button']['#value'] == t('Save') && count($form_state['values']['parent']) > 1 && $form['#vocabulary']->hierarchy < 2) {
|
||||
elseif ($form_state['triggering_element']['#value'] == t('Save') && count($form_state['values']['parent']) > 1 && $form['#vocabulary']->hierarchy < 2) {
|
||||
$form_state['rebuild'] = TRUE;
|
||||
$form_state['confirm_parents'] = TRUE;
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue