function content_translation_language_configuration_element_submit

Same name and namespace in other branches
  1. 9 core/modules/content_translation/content_translation.module \content_translation_language_configuration_element_submit()
  2. 8.9.x core/modules/content_translation/content_translation.module \content_translation_language_configuration_element_submit()
  3. 10 core/modules/content_translation/content_translation.module \content_translation_language_configuration_element_submit()

Form submission handler for element.

Stores the content translation settings.

See also

content_translation_language_configuration_element_validate()

1 string reference to 'content_translation_language_configuration_element_submit'
content_translation_language_configuration_element_process in core/modules/content_translation/content_translation.module
Process callback: Expands the language_configuration form element.

File

core/modules/content_translation/content_translation.module, line 152

Code

function content_translation_language_configuration_element_submit(array $form, FormStateInterface $form_state) : void {
  $key = $form_state->get([
    'content_translation',
    'key',
  ]);
  $context = $form_state->get([
    'language',
    $key,
  ]);
  $enabled = $form_state->getValue([
    $key,
    'content_translation',
  ]);
  if (\Drupal::service('content_translation.manager')->isEnabled($context['entity_type'], $context['bundle']) != $enabled) {
    \Drupal::service('content_translation.manager')->setEnabled($context['entity_type'], $context['bundle'], $enabled);
    \Drupal::service('router.builder')->setRebuildNeeded();
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.