diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index 4a03975..6d2c9fb 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -80,6 +80,15 @@ public function form(array $form, array &$form_state, EntityInterface $entity) { if (!empty($info['fieldable'])) { field_attach_form($entity, $form, $form_state, $this->getFormLangcode($form_state)); } + if (!isset($form['langcode'])) { + // If the form did not specify otherwise, default to keeping the existing + // language of the entity or defaulting to the site default language for + // new entities. + $form['langcode'] = array( + '#type' => 'value', + '#value' => !$entity->isNew() ? $entity->langcode : language_default()->langcode, + ); + } return $form; } diff --git a/core/modules/block/custom_block/config/custom_block.type.basic.yml b/core/modules/block/custom_block/config/custom_block.type.basic.yml index 1b0e2f8..58e87d7 100644 --- a/core/modules/block/custom_block/config/custom_block.type.basic.yml +++ b/core/modules/block/custom_block/config/custom_block.type.basic.yml @@ -2,3 +2,4 @@ id: basic label: Basic block revision: '0' description: A basic block contains a title and a body. +langcode: en diff --git a/core/modules/contact/config/contact.category.feedback.yml b/core/modules/contact/config/contact.category.feedback.yml index 8aff8c6..aae9098 100644 --- a/core/modules/contact/config/contact.category.feedback.yml +++ b/core/modules/contact/config/contact.category.feedback.yml @@ -3,3 +3,4 @@ label: 'Website feedback' recipients: [] reply: '' weight: '0' +langcode: en diff --git a/core/modules/filter/filter.admin.inc b/core/modules/filter/filter.admin.inc index 806c1d7..246f286 100644 --- a/core/modules/filter/filter.admin.inc +++ b/core/modules/filter/filter.admin.inc @@ -169,6 +169,11 @@ function filter_admin_format_form($form, &$form_state, $format) { '#disabled' => !empty($format->format), '#weight' => -20, ); + // @todo Remove once moved to FilterFormatFormController. + $form['langcode'] = array( + '#type' => 'value', + '#value' => !$format->isNew() ? $format->langcode : language_default()->langcode, + ); // Add user role access selection. $form['roles'] = array( diff --git a/core/modules/user/config/user.role.anonymous.yml b/core/modules/user/config/user.role.anonymous.yml index 11defb0..1947f35 100644 --- a/core/modules/user/config/user.role.anonymous.yml +++ b/core/modules/user/config/user.role.anonymous.yml @@ -1,3 +1,4 @@ id: anonymous label: Anonymous user weight: 0 +langcode: en diff --git a/core/modules/user/config/user.role.authenticated.yml b/core/modules/user/config/user.role.authenticated.yml index dc4b65d..16df96d 100644 --- a/core/modules/user/config/user.role.authenticated.yml +++ b/core/modules/user/config/user.role.authenticated.yml @@ -1,3 +1,4 @@ id: authenticated label: Authenticated user weight: 1 +langcode: en diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc index c3931d8..882cef2 100644 --- a/core/modules/user/user.admin.inc +++ b/core/modules/user/user.admin.inc @@ -1004,6 +1004,11 @@ function user_admin_role($form, $form_state, $role) { 'source' => array('role', 'label'), ), ); + // @todo Remove once moved to RoleFormController. + $form['role']['langcode'] = array( + '#type' => 'value', + '#value' => !$role->isNew() ? $role->langcode : language_default()->langcode, + ); $form['role']['weight'] = array( '#type' => 'value', '#value' => $role->weight,