You are here

public function ConfigureMultilingualForm::submitForm in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 9.0.x

Same name and namespace in other branches
  1. 8.8 src/Form/ConfigureMultilingualForm.php \Drupal\varbase\Form\ConfigureMultilingualForm::submitForm()
  2. 8.4 src/Form/ConfigureMultilingualForm.php \Drupal\varbase\Form\ConfigureMultilingualForm::submitForm()
  3. 8.5 src/Form/ConfigureMultilingualForm.php \Drupal\varbase\Form\ConfigureMultilingualForm::submitForm()
  4. 8.6 src/Form/ConfigureMultilingualForm.php \Drupal\varbase\Form\ConfigureMultilingualForm::submitForm()
  5. 8.7 src/Form/ConfigureMultilingualForm.php \Drupal\varbase\Form\ConfigureMultilingualForm::submitForm()

Form submission handler.

Parameters

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

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

Overrides FormInterface::submitForm

File

src/Form/ConfigureMultilingualForm.php, line 170

Class

ConfigureMultilingualForm
Defines form for selecting Varbase's Multiligual configuration options form.

Namespace

Drupal\varbase\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Get the value of enable multilingual checkbox.
  $enable_multilingual = $form_state
    ->getValue('enable_multilingual');
  if (isset($enable_multilingual) && $enable_multilingual == TRUE) {
    $GLOBALS['install_state']['varbase']['enable_multilingual'] = TRUE;
  }
  else {
    $GLOBALS['install_state']['varbase']['enable_multilingual'] = FALSE;
  }

  // Get list of selected multilingual languages.
  $multilingual_languages = $form_state
    ->getValue('multilingual_languages');
  if (isset($multilingual_languages) && is_array($multilingual_languages) && count($multilingual_languages) > 0) {
    $multilingual_languages = array_filter($multilingual_languages);
  }
  else {
    $multilingual_languages = [];
  }
  $GLOBALS['install_state']['varbase']['multilingual_languages'] = $multilingual_languages;
}