Commit 8f23dc86 authored by alexpott's avatar alexpott
Browse files

Issue #2318099 by tim.plunkett: Replace $form_state['complete_form'] with...

Issue #2318099 by tim.plunkett: Replace $form_state['complete_form'] with $form_state->getCompleteForm().
parent b5c736da
...@@ -388,7 +388,8 @@ function _batch_next_set() { ...@@ -388,7 +388,8 @@ function _batch_next_set() {
if (isset($current_set['form_submit']) && ($callback = $current_set['form_submit']) && is_callable($callback)) { if (isset($current_set['form_submit']) && ($callback = $current_set['form_submit']) && is_callable($callback)) {
// We use our stored copies of $form and $form_state to account for // We use our stored copies of $form and $form_state to account for
// possible alterations by previous form submit handlers. // possible alterations by previous form submit handlers.
call_user_func_array($callback, array(&$batch['form_state']['complete_form'], &$batch['form_state'])); $complete_form = &$batch['form_state']->getCompleteForm();
call_user_func_array($callback, array(&$complete_form, &$batch['form_state']));
} }
return TRUE; return TRUE;
} }
......
...@@ -1792,7 +1792,7 @@ function form_process_machine_name($element, FormStateInterface $form_state) { ...@@ -1792,7 +1792,7 @@ function form_process_machine_name($element, FormStateInterface $form_state) {
// complete form in $form_state. By reference, because we may need to append // complete form in $form_state. By reference, because we may need to append
// a #field_suffix that will hold the live preview. // a #field_suffix that will hold the live preview.
$key_exists = NULL; $key_exists = NULL;
$source = NestedArray::getValue($form_state['complete_form'], $element['#machine_name']['source'], $key_exists); $source = NestedArray::getValue($form_state->getCompleteForm(), $element['#machine_name']['source'], $key_exists);
if (!$key_exists) { if (!$key_exists) {
return $element; return $element;
} }
...@@ -1810,7 +1810,7 @@ function form_process_machine_name($element, FormStateInterface $form_state) { ...@@ -1810,7 +1810,7 @@ function form_process_machine_name($element, FormStateInterface $form_state) {
$source['#field_suffix'] = SafeMarkup::set($source['#field_suffix'] . ' <small id="' . $suffix_id . '">&nbsp;</small>'); $source['#field_suffix'] = SafeMarkup::set($source['#field_suffix'] . ' <small id="' . $suffix_id . '">&nbsp;</small>');
$parents = array_merge($element['#machine_name']['source'], array('#field_suffix')); $parents = array_merge($element['#machine_name']['source'], array('#field_suffix'));
NestedArray::setValue($form_state['complete_form'], $parents, $source['#field_suffix']); NestedArray::setValue($form_state->getCompleteForm(), $parents, $source['#field_suffix']);
} }
$js_settings = array( $js_settings = array(
......
...@@ -382,7 +382,7 @@ public function flagErrors(FieldItemListInterface $items, ConstraintViolationLis ...@@ -382,7 +382,7 @@ public function flagErrors(FieldItemListInterface $items, ConstraintViolationLis
$form_builder = \Drupal::formBuilder(); $form_builder = \Drupal::formBuilder();
// Locate the correct element in the the form. // Locate the correct element in the the form.
$element = NestedArray::getValue($form_state['complete_form'], $field_state['array_parents']); $element = NestedArray::getValue($form_state->getCompleteForm(), $field_state['array_parents']);
// Do not report entity-level validation errors if Form API errors have // Do not report entity-level validation errors if Form API errors have
// already been reported for the field. // already been reported for the field.
......
...@@ -752,7 +752,8 @@ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state ...@@ -752,7 +752,8 @@ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state
// checkboxes and files. // checkboxes and files.
if (isset($element['#process']) && !$element['#processed']) { if (isset($element['#process']) && !$element['#processed']) {
foreach ($element['#process'] as $process) { foreach ($element['#process'] as $process) {
$element = call_user_func_array($process, array(&$element, &$form_state, &$form_state['complete_form'])); $complete_form = &$form_state->getCompleteForm();
$element = call_user_func_array($process, array(&$element, &$form_state, &$complete_form));
} }
$element['#processed'] = TRUE; $element['#processed'] = TRUE;
} }
......
...@@ -251,7 +251,8 @@ protected function doValidateForm(&$elements, FormStateInterface &$form_state, $ ...@@ -251,7 +251,8 @@ protected function doValidateForm(&$elements, FormStateInterface &$form_state, $
// #value data. // #value data.
elseif (isset($elements['#element_validate'])) { elseif (isset($elements['#element_validate'])) {
foreach ($elements['#element_validate'] as $callback) { foreach ($elements['#element_validate'] as $callback) {
call_user_func_array($callback, array(&$elements, &$form_state, &$form_state['complete_form'])); $complete_form = &$form_state->getCompleteForm();
call_user_func_array($callback, array(&$elements, &$form_state, &$complete_form));
} }
} }
......
...@@ -106,7 +106,7 @@ public function validate(array $form, FormStateInterface $form_state) { ...@@ -106,7 +106,7 @@ public function validate(array $form, FormStateInterface $form_state) {
$responsive_image_mapping->setMappings($form_state->getValue('mappings')); $responsive_image_mapping->setMappings($form_state->getValue('mappings'));
// Check if another breakpoint group is selected. // Check if another breakpoint group is selected.
if ($form_state->getValue('breakpointGroup') != $form_state['complete_form']['breakpointGroup']['#default_value']) { if ($form_state->getValue('breakpointGroup') != $form_state->getCompleteForm()['breakpointGroup']['#default_value']) {
// Remove the mappings. // Remove the mappings.
$form_state->unsetValue('mappings'); $form_state->unsetValue('mappings');
} }
......
...@@ -485,8 +485,9 @@ function user_user_view(array &$build, UserInterface $account, EntityViewDisplay ...@@ -485,8 +485,9 @@ function user_user_view(array &$build, UserInterface $account, EntityViewDisplay
*/ */
function _user_language_selector_langcode_value($element, $input, FormStateInterface $form_state) { function _user_language_selector_langcode_value($element, $input, FormStateInterface $form_state) {
// Only add to the description if the form element have a description. // Only add to the description if the form element have a description.
if (isset($form_state['complete_form']['language']['preferred_langcode']['#description'])) { $complete_form = &$form_state->getCompleteForm();
$form_state['complete_form']['language']['preferred_langcode']['#description'] .= ' ' . t("This is also assumed to be the primary language of this account's profile information."); if (isset($complete_form['language']['preferred_langcode']['#description'])) {
$complete_form['language']['preferred_langcode']['#description'] .= ' ' . t("This is also assumed to be the primary language of this account's profile information.");
} }
return $form_state->getValue('preferred_langcode'); return $form_state->getValue('preferred_langcode');
} }
......
...@@ -129,7 +129,7 @@ function views_ui_add_limited_validation($element, FormStateInterface $form_stat ...@@ -129,7 +129,7 @@ function views_ui_add_limited_validation($element, FormStateInterface $form_stat
$array_parents = $element['#array_parents']; $array_parents = $element['#array_parents'];
array_pop($array_parents); array_pop($array_parents);
$array_parents[] = $element['#views_ui_ajax_data']['trigger_key']; $array_parents[] = $element['#views_ui_ajax_data']['trigger_key'];
$ajax_triggering_element = NestedArray::getValue($form_state['complete_form'], $array_parents); $ajax_triggering_element = NestedArray::getValue($form_state->getCompleteForm(), $array_parents);
// Limit this button's validation to the AJAX triggering element, so it can // Limit this button's validation to the AJAX triggering element, so it can
// update the form for that change without requiring that the rest of the // update the form for that change without requiring that the rest of the
...@@ -165,7 +165,7 @@ function views_ui_add_ajax_wrapper($element, FormStateInterface $form_state) { ...@@ -165,7 +165,7 @@ function views_ui_add_ajax_wrapper($element, FormStateInterface $form_state) {
if (empty($element['#views_ui_ajax_data']['duplicate_wrapper'])) { if (empty($element['#views_ui_ajax_data']['duplicate_wrapper'])) {
// Find the region of the complete form that needs to be refreshed by AJAX. // Find the region of the complete form that needs to be refreshed by AJAX.
// This was earlier stored in a property on the element. // This was earlier stored in a property on the element.
$complete_form = &$form_state['complete_form']; $complete_form = &$form_state->getCompleteForm();
$refresh_parents = $element['#views_ui_ajax_data']['refresh_parents']; $refresh_parents = $element['#views_ui_ajax_data']['refresh_parents'];
$refresh_element = NestedArray::getValue($complete_form, $refresh_parents); $refresh_element = NestedArray::getValue($complete_form, $refresh_parents);
......
Supports Markdown
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