You are here

public static function TranslatorForm::updateRemoteLanguagesMappings in Translation Management Tool 8

Updates remote languages mappings.

Parameters

array $form: An associative array containing the initial structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the complete form.

File

src/Form/TranslatorForm.php, line 216

Class

TranslatorForm
Form controller for the translator edit forms.

Namespace

Drupal\tmgmt\Form

Code

public static function updateRemoteLanguagesMappings(array $form, FormStateInterface $form_state) {
  if (!empty($form_state
    ->getUserInput()['remote_languages_mappings'])) {

    // The user input containing remote languages mappings from an old
    // translator, so We have to remove them from here.
    $user_input = $form_state
      ->getUserInput();
    unset($user_input['remote_languages_mappings']);
    $form_state
      ->setUserInput($user_input);
  }
  $form_state
    ->setRebuild();
}