Commit dbed0b48 authored by webchick's avatar webchick

Issue #2335659 by tim.plunkett, dawehner, effulgentsia, sun: Remove FormState...

Issue #2335659 by tim.plunkett, dawehner, effulgentsia, sun: Remove FormState ArrayAccess usage from core.
parent 360af27e
......@@ -101,7 +101,7 @@
* @code
* $format_value = \Drupal\Component\Utility\NestedArray::getValue(
* $form_state->getValues(),
* $form_state['triggering_element']['#array_parents']);
* $form_state->getTriggeringElement()['#array_parents']);
* @endcode
*
* Once you have processed the input, you have your choice of returning HTML
......
......@@ -470,7 +470,7 @@ function _batch_finished() {
// If no redirection happened, redirect to the originating page. In case the
// form needs to be rebuilt, save the final $form_state for
// \Drupal\Core\Form\FormBuilderInterface::buildForm().
if (!empty($_batch['form_state']['rebuild'])) {
if ($_batch['form_state']->isRebuilding()) {
$_SESSION['batch_form_state'] = $_batch['form_state'];
}
$callback = $_batch['redirect_callback'];
......
......@@ -136,7 +136,7 @@ function form_state_values_clean(FormStateInterface $form_state) {
// Remove button values.
// form_builder() collects all button elements in a form. We remove the button
// value separately for each button element.
foreach ($form_state['buttons'] as $button) {
foreach ($form_state->getButtons() as $button) {
// Remove this button's value from the submitted form values by finding
// the value corresponding to this button.
// We iterate over the #parents of this button and move a reference to
......
......@@ -814,7 +814,7 @@ function install_get_form($form_id, array &$install_state) {
$form = $form_builder->buildForm($form_id, $form_state);
// If the form submission was not successful, the form needs to be rendered,
// which means the task is not complete yet.
if (empty($form_state['executed'])) {
if (!$form_state->isExecuted()) {
$install_state['task_not_complete'] = TRUE;
return $form;
}
......
......@@ -360,7 +360,7 @@ public function validateConfigurationForm(array &$form, FormStateInterface $form
->setValues($form_state->getValue(['visibility', $condition_id]));
$condition->validateConfigurationForm($form, $condition_values);
// Update the original form values.
$form_state->setValue(array('visibility', $condition_id), $condition_values['values']);
$form_state->setValue(['visibility', $condition_id], $condition_values->getValues());
}
$this->blockValidate($form, $form_state);
......@@ -392,7 +392,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s
->setValues($form_state->getValue(['visibility', $condition_id]));
$condition->submitConfigurationForm($form, $condition_values);
// Update the original form values.
$form_state->setValue(array('visibility', $condition_id), $condition_values['values']);
$form_state->setValue(['visibility', $condition_id], $condition_values->getValues());
}
$this->blockSubmit($form, $form_state);
}
......
......@@ -76,7 +76,7 @@ public function getContentResult(Request $request) {
// Remove $form and $form_state from the arguments, and re-index them.
unset($args[0], $args[1]);
$form_state['build_info']['args'] = array_values($args);
$form_state->addBuildInfo('args', array_values($args));
return $this->formBuilder->buildForm($form_object, $form_state);
}
......
......@@ -330,7 +330,7 @@ public static function processDatetime(&$element, FormStateInterface $form_state
*/
public static function validateDatetime(&$element, FormStateInterface $form_state, &$complete_form) {
$input_exists = FALSE;
$input = NestedArray::getValue($form_state['values'], $element['#parents'], $input_exists);
$input = NestedArray::getValue($form_state->getValues(), $element['#parents'], $input_exists);
if ($input_exists) {
$title = !empty($element['#title']) ? $element['#title'] : '';
......
......@@ -64,7 +64,7 @@ public function validate(array $form, FormStateInterface $form_state) {
// @todo Remove this.
// Execute legacy global validation handlers.
unset($form_state['validate_handlers']);
$form_state->setValidateHandlers([]);
form_execute_handlers('validate', $form, $form_state);
}
......@@ -87,13 +87,13 @@ protected function init(FormStateInterface $form_state) {
* {@inheritdoc}
*/
public function getFormLangcode(FormStateInterface $form_state) {
if (empty($form_state['langcode'])) {
if (!$form_state->has('langcode')) {
// Imply a 'view' operation to ensure users edit entities in the same
// language they are displayed. This allows to keep contextual editing
// working also for multilingual entities.
$form_state['langcode'] = $this->entityManager->getTranslationFromContext($this->entity)->language()->id;
$form_state->set('langcode', $this->entityManager->getTranslationFromContext($this->entity)->language()->id);
}
return $form_state['langcode'];
return $form_state->get('langcode');
}
/**
......@@ -124,14 +124,14 @@ protected function copyFormValuesToEntity(EntityInterface $entity, array $form,
* {@inheritdoc}
*/
public function getFormDisplay(FormStateInterface $form_state) {
return isset($form_state['form_display']) ? $form_state['form_display'] : NULL;
return $form_state->get('form_display');
}
/**
* {@inheritdoc}
*/
public function setFormDisplay(EntityFormDisplayInterface $form_display, FormStateInterface $form_state) {
$form_state['form_display'] = $form_display;
$form_state->set('form_display', $form_display);
return $this;
}
......
......@@ -89,7 +89,7 @@ public function getFormId() {
public function buildForm(array $form, FormStateInterface $form_state) {
// During the initial form build, add this form object to the form state and
// allow for initial preparation before form building and processing.
if (!isset($form_state['entity_form_initialized'])) {
if (!$form_state->has('entity_form_initialized')) {
$this->init($form_state);
}
......@@ -110,7 +110,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
*/
protected function init(FormStateInterface $form_state) {
// Flag that this form has been initialized.
$form_state['entity_form_initialized'] = TRUE;
$form_state->set('entity_form_initialized', TRUE);
// Prepare the entity to be presented in the entity form.
$this->prepareEntity();
......@@ -235,7 +235,7 @@ public function validate(array $form, FormStateInterface $form_state) {
$this->updateFormLangcode($form_state);
// @todo Remove this.
// Execute legacy global validation handlers.
unset($form_state['validate_handlers']);
$form_state->setValidateHandlers([]);
form_execute_handlers('validate', $form, $form_state);
}
......@@ -293,7 +293,7 @@ public function isDefaultFormLangcode(FormStateInterface $form_state) {
protected function updateFormLangcode(FormStateInterface $form_state) {
// Update the form language as it might have changed.
if ($form_state->hasValue('langcode') && $this->isDefaultFormLangcode($form_state)) {
$form_state['langcode'] = $form_state->getValue('langcode');
$form_state->set('langcode', $form_state->getValue('langcode'));
}
}
......
......@@ -30,8 +30,8 @@
* langcode. Defaults to an empty array.
*
* @code
* $form_state['langcode'] = $langcode;
* $form = \Drupal::service('entity.form_builder')->getForm($entity, 'default', $form_state);
* $form_state_additions['langcode'] = $langcode;
* $form = \Drupal::service('entity.form_builder')->getForm($entity, 'default', $form_state_additions);
* @endcode
*
* @return array
......
......@@ -368,7 +368,7 @@ public static function processDefaultValue($default_value, ContentEntityInterfac
* A Widget object.
*/
protected function defaultValueWidget(FormStateInterface $form_state) {
if (!isset($form_state['default_value_widget'])) {
if (!$form_state->has('default_value_widget')) {
$entity = $this->getEntity();
// Force a non-required widget.
......@@ -383,10 +383,10 @@ protected function defaultValueWidget(FormStateInterface $form_state) {
$widget = \Drupal::service('plugin.manager.field.widget')->getInstance(array('field_definition' => $this->getFieldDefinition()));
}
$form_state['default_value_widget'] = $widget;
$form_state->set('default_value_widget', $widget);
}
return $form_state['default_value_widget'];
return $form_state->get('default_value_widget');
}
}
......@@ -106,8 +106,8 @@ public function form(FieldItemListInterface $items, array &$form, FormStateInter
$elements = $this->formMultipleElements($items, $form, $form_state);
}
// Populate the 'array_parents' information in $form_state['field'] after
// the form is built, so that we catch changes in the form structure
// Populate the 'array_parents' information in $form_state->get('field')
// after the form is built, so that we catch changes in the form structure
// performed in alter() hooks.
$elements['#after_build'][] = array(get_class($this), 'afterBuild');
$elements['#field_name'] = $field_name;
......@@ -207,8 +207,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f
);
// Add 'add more' button, if not working with a programmed form.
if ($cardinality == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED && empty($form_state['programmed'])) {
if ($cardinality == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED && !$form_state->isProgrammed()) {
$id_prefix = implode('-', array_merge($parents, array($field_name)));
$wrapper_id = drupal_html_id($id_prefix . '-add-more-wrapper');
$elements['#prefix'] = '<div id="' . $wrapper_id . '">';
......@@ -254,7 +253,7 @@ public static function afterBuild(array $element, FormStateInterface $form_state
* Submission handler for the "Add another item" button.
*/
public static function addMoreSubmit(array $form, FormStateInterface $form_state) {
$button = $form_state['triggering_element'];
$button = $form_state->getTriggeringElement();
// Go one level up in the form, to the widgets container.
$element = NestedArray::getValue($form, array_slice($button['#array_parents'], 0, -1));
......@@ -266,7 +265,7 @@ public static function addMoreSubmit(array $form, FormStateInterface $form_state
$field_state['items_count']++;
static::setWidgetState($parents, $field_name, $form_state, $field_state);
$form_state['rebuild'] = TRUE;
$form_state->setRebuild();
}
/**
......@@ -276,7 +275,7 @@ public static function addMoreSubmit(array $form, FormStateInterface $form_state
* by the form submission.
*/
public static function addMoreAjax(array $form, FormStateInterface $form_state) {
$button = $form_state['triggering_element'];
$button = $form_state->getTriggeringElement();
// Go one level up in the form, to the widgets container.
$element = NestedArray::getValue($form, array_slice($button['#array_parents'], 0, -1));
......@@ -439,14 +438,14 @@ public function flagErrors(FieldItemListInterface $items, ConstraintViolationLis
* {@inheritdoc}
*/
public static function getWidgetState(array $parents, $field_name, FormStateInterface $form_state) {
return NestedArray::getValue($form_state['storage'], static::getWidgetStateParents($parents, $field_name));
return NestedArray::getValue($form_state->getStorage(), static::getWidgetStateParents($parents, $field_name));
}
/**
* {@inheritdoc}
*/
public static function setWidgetState(array $parents, $field_name, FormStateInterface $form_state, array $field_state) {
NestedArray::setValue($form_state['storage'], static::getWidgetStateParents($parents, $field_name), $field_state);
NestedArray::setValue($form_state->getStorage(), static::getWidgetStateParents($parents, $field_name), $field_state);
}
/**
......@@ -462,7 +461,7 @@ public static function setWidgetState(array $parents, $field_name, FormStateInte
*/
protected static function getWidgetStateParents(array $parents, $field_name) {
// Field processing data is placed at
// $form_state['field']['#parents'][...$parents...]['#fields'][$field_name],
// $form_state->get(['field', '#parents', ...$parents..., '#fields', $field_name]),
// to avoid clashes between field names and $parents parts.
return array_merge(array('field', '#parents'), $parents, array('#fields', $field_name));
}
......
......@@ -140,7 +140,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
public function validateForm(array &$form, FormStateInterface $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['triggering_element']['#name'] != 'process_updates') {
if ($form_state->getTriggeringElement()['#name'] != 'process_updates') {
return;
}
......@@ -169,7 +169,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$form_connection_settings = $form_state->getValue('connection_settings');
switch ($form_state['triggering_element']['#name']) {
switch ($form_state->getTriggeringElement()['#name']) {
case 'process_updates':
// Save the connection settings to the DB.
......@@ -214,11 +214,11 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
break;
case 'enter_connection_settings':
$form_state['rebuild'] = TRUE;
$form_state->setRebuild();
break;
case 'change_connection_type':
$form_state['rebuild'] = TRUE;
$form_state->setRebuild();
$form_state->unsetValue(array('connection_settings', 'authorize_filetransfer_default'));
break;
}
......
......@@ -13,10 +13,8 @@
/**
* Stores information about the state of a form.
*
* @todo Remove usage of \ArrayAccess in https://www.drupal.org/node/2310255.
*/
class FormState implements FormStateInterface, \ArrayAccess {
class FormState implements FormStateInterface {
/**
* Tracks if any errors have been set on any form.
......@@ -808,61 +806,6 @@ public function &getCompleteForm() {
return $this->complete_form;
}
/**
* {@inheritdoc}
*
* @deprecated in Drupal 8.0.x, might be removed before Drupal 8.0.0.
*/
public function offsetExists($offset) {
return isset($this->{$offset}) || isset($this->storage[$offset]);
}
/**
* {@inheritdoc}
*
* @deprecated in Drupal 8.0.x, might be removed before Drupal 8.0.0.
*/
public function &offsetGet($offset) {
if (property_exists($this, $offset)) {
$value = &$this->{$offset};
}
else {
if (!isset($this->storage[$offset])) {
$this->storage[$offset] = NULL;
}
$value = &$this->get($offset);
}
return $value;
}
/**
* {@inheritdoc}
*
* @deprecated in Drupal 8.0.x, might be removed before Drupal 8.0.0.
*/
public function offsetSet($offset, $value) {
if (property_exists($this, $offset)) {
$this->{$offset} = $value;
}
else {
$this->set($offset, $value);
}
}
/**
* {@inheritdoc}
*
* @deprecated in Drupal 8.0.x, might be removed before Drupal 8.0.0.
*/
public function offsetUnset($offset) {
if (property_exists($this, $offset)) {
$this->{$offset} = NULL;
}
else {
unset($this->storage[$offset]);
}
}
/**
* {@inheritdoc}
*/
......
......@@ -93,8 +93,9 @@ public function buildForm(array $form, FormStateInterface $form_state, $install_
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$install_state = &$form_state['build_info']['args'][0];
$install_state['parameters']['langcode'] = $form_state->getValue('langcode');
$build_info = $form_state->getBuildInfo();
$build_info['args'][0]['parameters']['langcode'] = $form_state->getValue('langcode');
$form_state->setBuildInfo($build_info);
}
}
......@@ -126,7 +126,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
$database['namespace'] = substr($install_namespace, 0, strrpos($install_namespace, '\\'));
$database['driver'] = $driver;
$form_state['storage']['database'] = $database;
$form_state->set('database', $database);
$errors = install_database_errors($database, $form_state->getValue('settings_file'));
foreach ($errors as $name => $message) {
$form_state->setErrorByName($name, $message);
......@@ -141,7 +141,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// Update global settings array and save.
$settings = array();
$database = $form_state['storage']['database'];
$database = $form_state->get('database');
$settings['databases']['default']['default'] = (object) array(
'value' => $database,
'required' => TRUE,
......
......@@ -142,7 +142,7 @@ public static function processMachineName(&$element, FormStateInterface $form_st
// complete form in $form_state. By reference, because we may need to append
// a #field_suffix that will hold the live preview.
$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) {
return $element;
}
......@@ -160,7 +160,7 @@ public static function processMachineName(&$element, FormStateInterface $form_st
$source['#field_suffix'] = SafeMarkup::set($source['#field_suffix'] . ' <small id="' . $suffix_id . '">&nbsp;</small>');
$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(
......
......@@ -82,7 +82,7 @@ public static function validatePasswordConfirm(&$element, FormStateInterface $fo
$form_state->setError($element, t('The specified passwords do not match.'));
}
}
elseif ($element['#required'] && !empty($form_state['input'])) {
elseif ($element['#required'] && $form_state->getUserInput()) {
$form_state->setError($element, t('Password field is required.'));
}
......
......@@ -128,7 +128,7 @@ public static function preRenderGroup($element) {
public static function processAjaxForm(&$element, FormStateInterface $form_state, &$complete_form) {
$element = ajax_pre_render_element($element);
if (!empty($element['#ajax_processed'])) {
$form_state['cache'] = TRUE;
$form_state->setCached();
}
return $element;
}
......@@ -156,14 +156,15 @@ public static function processGroup(&$element, FormStateInterface $form_state, &
// Each details element forms a new group. The #type 'vertical_tabs' basically
// only injects a new details element.
$form_state['groups'][$parents]['#group_exists'] = TRUE;
$element['#groups'] = &$form_state['groups'];
$groups = &$form_state->getGroups();
$groups[$parents]['#group_exists'] = TRUE;
$element['#groups'] = &$groups;
// Process vertical tabs group member details elements.
if (isset($element['#group'])) {
// Add this details element to the defined group (by reference).
$group = $element['#group'];
$form_state['groups'][$group][] = &$element;
$groups[$group][] = &$element;
}
return $element;
......
......@@ -219,7 +219,8 @@ public static function processTable(&$element, FormStateInterface $form_state, &
public static function validateTable(&$element, FormStateInterface $form_state, &$complete_form) {
// Skip this validation if the button to submit the form does not require
// selected table row data.
if (empty($form_state['triggering_element']['#tableselect'])) {
$trigerring_element = $form_state->getTriggeringElement();
if (empty($trigerring_element['#tableselect'])) {
return;
}
if ($element['#multiple']) {
......
......@@ -61,7 +61,7 @@ public function form(array $form, FormStateInterface $form_state) {
if (!$theme = $entity->get('theme')) {
$theme = $this->config('system.theme')->get('default');
}
$form_state['block_theme'] = $theme;
$form_state->set('block_theme', $theme);
$form['#tree'] = TRUE;
$form['settings'] = $entity->getPlugin()->buildConfigurationForm(array(), $form_state);
......@@ -153,7 +153,7 @@ public function validate(array $form, FormStateInterface $form_state) {
// Call the plugin validate handler.
$this->entity->getPlugin()->validateConfigurationForm($form, $settings);
// Update the original form values.
$form_state->setValue('settings', $settings['values']);
$form_state->setValue('settings', $settings->getValues());
}
/**
......@@ -171,7 +171,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// Call the plugin submit handler.
$entity->getPlugin()->submitConfigurationForm($form, $settings);
// Update the original form values.
$form_state->setValue('settings', $settings['values']);
$form_state->setValue('settings', $settings->getValues());
// Save the settings of the plugin.
$entity->save();
......
......@@ -202,7 +202,7 @@ public function save(array $form, FormStateInterface $form_state) {
if ($block->id()) {
$form_state->setValue('id', $block->id());
$form_state['id'] = $block->id();
$form_state->set('id', $block->id());
if ($insert) {
if (!$theme = $block->getTheme()) {
$theme = $this->config('system.theme')->get('default');
......@@ -223,7 +223,7 @@ public function save(array $form, FormStateInterface $form_state) {
// In the unlikely case something went wrong on save, the block will be
// rebuilt and block form redisplayed.
drupal_set_message($this->t('The block could not be saved.'), 'error');
$form_state['rebuild'] = TRUE;
$form_state->setRebuild();
}
}
......
......@@ -219,7 +219,7 @@ function book_node_builder($entity_type, NodeInterface $entity, &$form, FormStat
function book_pick_book_nojs_submit($form, FormStateInterface $form_state) {
$node = $form_state->getFormObject()->getEntity();
$node->book = $form_state->getValue('book');
$form_state['rebuild'] = TRUE;
$form_state->setRebuild();
}
/**
......
......@@ -86,7 +86,7 @@ public function settingsForm(array $form, FormStateInterface $form_state, Editor
*/
function validateImageUploadSettings(array $element, FormStateInterface $form_state) {
$settings = &$form_state->getValue(array('editor', 'settings', 'plugins', 'drupalimage', 'image_upload'));
$form_state['editor']->setImageUploadSettings($settings);
$form_state->get('editor')->setImageUploadSettings($settings);
$form_state->unsetValue(array('editor', 'settings', 'plugins', 'drupalimage'));
}
......
......@@ -47,7 +47,8 @@ function color_theme() {
* Implements hook_form_FORM_ID_alter().
*/
function color_form_system_theme_settings_alter(&$form, FormStateInterface $form_state) {
if (isset($form_state['build_info']['args'][0]) && ($theme = $form_state['build_info']['args'][0]) && color_get_info($theme) && function_exists('gd_info')) {
$build_info = $form_state->getBuildInfo();
if (isset($build_info['args'][0]) && ($theme = $build_info['args'][0]) && color_get_info($theme) && function_exists('gd_info')) {
$form['color'] = array(
'#type' => 'details',
'#title' => t('Color scheme'),
......@@ -303,7 +304,8 @@ function color_palette_color_value($element, $input = FALSE, FormStateInterface
// Start with the provided value for this textfield, and validate that if
// necessary, falling back on the default value.
$value = Textfield::valueCallback($element, $input, $form_state);
if (!$value || !isset($form_state['complete form']['#token']) || color_valid_hexadecimal_string($value) || \Drupal::csrfToken()->validate($form_state->getValue('form_token'), $form_state['complete form']['#token'])) {
$complete_form = $form_state->getCompleteForm();
if (!$value || !isset($complete_form['#token']) || color_valid_hexadecimal_string($value) || \Drupal::csrfToken()->validate($form_state->getValue('form_token'), $complete_form['#token'])) {
return $value;
}
else {
......
......@@ -98,8 +98,9 @@ public function form(array $form, FormStateInterface $form_state) {
$form['#action'] = url('comment/reply/' . $entity->getEntityTypeId() . '/' . $entity->id() . '/' . $field_name);
}
if (isset($form_state['comment_preview'])) {
$form += $form_state['comment_preview'];
$comment_preview = $form_state->get('comment_preview');
if (isset($comment_preview)) {
$form += $comment_preview;
}
$form['author'] = array();
......@@ -115,7 +116,7 @@ public function form(array $form, FormStateInterface $form_state) {
if ($is_admin) {
$author = $comment->getAuthorName();
$status = $comment->getStatus();
if (empty($form_state['comment_preview'])) {
if (empty($comment_preview)) {
$form['#title'] = $this->t('Edit comment %title', array(
'%title' => $comment->getSubject(),
));
......@@ -238,7 +239,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
// Only show the save button if comment previews are optional or if we are
// already previewing the submission.
$element['submit']['#access'] = ($comment->id() && $this->currentUser->hasPermission('administer comments')) || $preview_mode != DRUPAL_REQUIRED || isset($form_state['comment_preview']);
$element['submit']['#access'] = ($comment->id() && $this->currentUser->hasPermission('administer comments')) || $preview_mode != DRUPAL_REQUIRED || $form_state->get('comment_preview');
$element['preview'] = array(
'#type' => 'submit',
......@@ -348,10 +349,10 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
* The current state of the form.
*/
public function preview(array &$form, FormStateInterface $form_state) {
$comment = $this->entity;
$form_state['comment_preview'] = comment_preview($comment, $form_state);
$form_state['comment_preview']['#title'] = $this->t('Preview comment');
$form_state['rebuild'] = TRUE;
$comment_preview = comment_preview($this->entity, $form_state);
$comment_preview['#title'] = $this->t('Preview comment');
$form_state->set('comment_preview', $comment_preview);
$form_state->setRebuild();
}
/**
......
......@@ -236,7 +236,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
public function submitForm(array &$form, FormStateInterface $form_state) {
// If this form has not yet been confirmed, store the values and rebuild.
if (!$this->data) {
$form_state['rebuild'] = TRUE;
$form_state->setRebuild();
$this->data = $form_state->getValues();
return;
}
......
......@@ -179,7 +179,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
}
else {
// Store the comparer for use in the submit.
$form_state['storage_comparer'] = $storage_comparer;
$form_state->set('storage_comparer', $storage_comparer);
}
// Add the AJAX library to the form for dialog support.
......@@ -273,7 +273,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config_importer = new ConfigImporter(
$form_state['storage_comparer'],
$form_state->get('storage_comparer'),
$this->eventDispatcher,
$this->configManager,
$this->lock,
......
......@@ -173,9 +173,9 @@ public function buildForm(array $form, FormStateInterface $form_state, Request $
$this->languageManager->setConfigOverrideLanguage($this->language);
// Add some information to the form state for easier form altering.
$form_state['config_translation_mapper'] = $this->mapper;