diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 0c67558..6e5eb38 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -498,7 +498,8 @@ function content_translation_language_configuration_element_process(array $eleme '#prefix' => '', ); - $form['actions']['submit']['#submit'][] = 'content_translation_language_configuration_element_submit'; + $submit_name = isset($form['actions']['save_continue']) ? 'save_continue' : 'submit'; + $form['actions'][$submit_name]['#submit'][] = 'content_translation_language_configuration_element_submit'; } return $element; } @@ -535,6 +536,7 @@ function content_translation_language_configuration_element_validate($element, F */ function content_translation_language_configuration_element_submit(array $form, FormStateInterface $form_state) { $key = $form_state->get(['content_translation', 'key']); + $context = $form_state->get(['language', $key]); $enabled = $form_state->getValue(array($key, 'content_translation')); diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 01f3d0b..16148ba 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -207,17 +207,21 @@ function language_configuration_element_submit(&$form, FormStateInterface $form_ $entity_type_id = $values['entity_type']; $bundle = $values['bundle']; $form_object = $form_state->getFormObject(); - if ($form_object instanceof EntityFormInterface && !$form_object->getEntity()->isNew() && in_array($form_object->getOperation(), ['default', 'edit'])) { + if ($form_object instanceof EntityFormInterface) { /** @var EntityFormInterface $form_object */ $entity = $form_object->getEntity(); if ($entity->getEntityType()->getBundleOf()) { $bundle = $entity->id(); + $language[$element_name]['bundle'] = $bundle; } } $config = ContentLanguageSettings::loadByEntityTypeBundle($entity_type_id, $bundle); $config->setDefaultLangcode($form_state->getValue(array($element_name, 'langcode'))); $config->setLanguageAlterable($form_state->getValue(array($element_name, 'language_alterable'))); $config->save(); + + // Set the form_state languaged with the updated bundle. + $form_state->set('language', $language); } } } diff --git a/core/modules/language/src/Element/LanguageConfiguration.php b/core/modules/language/src/Element/LanguageConfiguration.php index 02c1788..450edcd 100644 --- a/core/modules/language/src/Element/LanguageConfiguration.php +++ b/core/modules/language/src/Element/LanguageConfiguration.php @@ -73,17 +73,20 @@ public static function processLanguageConfiguration(&$element, FormStateInterfac // Do not add the submit callback for the language content settings page, // which is handled separately. if ($form['#form_id'] != 'language_content_settings_form') { + // Determine where to attach the language_configuration element submit // handler. // @todo Form API: Allow form widgets/sections to declare #submit // handlers. - if (isset($form['actions']['submit']['#submit']) && array_search('language_configuration_element_submit', $form['actions']['submit']['#submit']) === FALSE) { - $form['actions']['submit']['#submit'][] = 'language_configuration_element_submit'; + $submit_name = isset($form['actions']['save_continue']) ? 'save_continue' : 'submit'; + if (isset($form['actions'][$submit_name]['#submit']) && array_search('language_configuration_element_submit', $form['actions'][$submit_name]['#submit']) === FALSE) { + $form['actions'][$submit_name]['#submit'][] = 'language_configuration_element_submit'; } elseif (array_search('language_configuration_element_submit', $form['#submit']) === FALSE) { $form['#submit'][] = 'language_configuration_element_submit'; } } + return $element; }