diff --git a/core/modules/language/language.module b/core/modules/language/language.module index ebe80fd..e464c3b 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -182,7 +182,7 @@ function language_configuration_element_submit(&$form, FormStateInterface $form_ // values. if ($language = $form_state->get('language')) { foreach ($language as $element_name => $values) { - $entityType = $values['entity_type']; + $entity_type_id = $values['entity_type']; $bundle = $values['bundle']; // In case we are editing a bundle, we must check the new bundle name, // because e.g. hook_ENTITY_update fired before. @@ -190,13 +190,13 @@ function language_configuration_element_submit(&$form, FormStateInterface $form_ if ($form_object instanceof EntityForm && !$form_object->getEntity()->isNew()) { /** @var EntityForm $form_object */ $entity = $form_object->getEntity(); - $entity_definition = Drupal::entityManager()->getDefinition($entityType); - if ($entity_definition instanceof ContentEntityType) { + $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); + if ($entity_type->getBundleOf()) { $bundle = $entity->id(); } } /** @var ContentLanguageSettings $config */ - $config = ContentLanguageSettings::loadByEntityTypeBundle($entityType, $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(); diff --git a/core/modules/language/src/ContentLanguageSettingsInterface.php b/core/modules/language/src/ContentLanguageSettingsInterface.php index 1b1322f..206bd14 100644 --- a/core/modules/language/src/ContentLanguageSettingsInterface.php +++ b/core/modules/language/src/ContentLanguageSettingsInterface.php @@ -11,7 +11,7 @@ use Drupal\Core\Config\Entity\ThirdPartySettingsInterface; /** - * Provides an interface defining content language settings entity. + * Provides an interface defining language settings for content entities. */ interface ContentLanguageSettingsInterface extends ConfigEntityInterface, ThirdPartySettingsInterface { @@ -33,6 +33,7 @@ public function getTargetBundle(); * Sets the bundle this config applies to. * * @param string $target_bundle + * The bundle. * * @return $this */ @@ -42,6 +43,7 @@ public function setTargetBundle($target_bundle); * Sets the default language code. * * @param string $default_langcode + * The default language code. * * @return $this; */ @@ -58,6 +60,7 @@ public function getDefaultLangcode(); * Sets if the language must be alterable or not. * * @param bool $language_alterable + * Flag indicating if the language must be alterable. * * @return $this */ diff --git a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php index 2a3b75b..cf40bf0 100644 --- a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php +++ b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php @@ -162,7 +162,7 @@ public function testTaxonomyVocabularyUpdate() { ); $this->drupalPostForm('admin/structure/taxonomy/manage/country', $edit, t('Save')); - // Check the language default configuration . + // Check the language default configuration. $configuration = language_get_default_configuration('taxonomy_term', 'country'); $uuid = ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', 'country')->uuid(); $this->assertEqual($configuration, array('langcode' => 'current_interface', 'language_alterable' => TRUE), 'The default language configuration has been saved on the Country vocabulary.');