You are here

public static function LingotekLanguageForm::languageEntityBuilder in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8 src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  2. 8.2 src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  3. 4.0.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  4. 3.0.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  5. 3.1.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  6. 3.2.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  7. 3.3.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  8. 3.5.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  9. 3.6.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  10. 3.7.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()
  11. 3.8.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::languageEntityBuilder()

Entity builder for the configurable language type form with lingotek options.

Parameters

string $entity_type: The entity type.

\Drupal\language\ConfigurableLanguageInterface $language: The language object.

array $form: The form definition array for the configurable language entity.

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

See also

lingotek_form_language_admin_add_form_alter()

lingotek_form_language_admin_edit_form_alter()

File

src/Form/LingotekLanguageForm.php, line 146

Class

LingotekLanguageForm
Alters the Drupal language module language forms.

Namespace

Drupal\lingotek\Form

Code

public static function languageEntityBuilder($entity_type, ConfigurableLanguageInterface $language, array &$form, FormStateInterface $form_state) {

  // We need to check if the value exists, as we are enabling by default those
  // predefined languages in Drupal.
  if ($form_state
    ->hasValue([
    'lingotek_locale',
  ])) {
    $lingotek_locale = $form_state
      ->getValue([
      'lingotek_locale',
    ]);
    $lingotekDisabled = $form_state
      ->getValue([
      'lingotek_disabled',
    ]);
    $language
      ->setThirdPartySetting('lingotek', 'locale', str_replace("-", "_", $lingotek_locale));
    $language
      ->setThirdPartySetting('lingotek', 'disabled', $lingotekDisabled);
  }
}