summaryrefslogtreecommitdiffstats
path: root/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/rest/src/Plugin/rest/resource/EntityResource.php')
-rw-r--r--core/modules/rest/src/Plugin/rest/resource/EntityResource.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
index c861239..b7d0264 100644
--- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
+++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
@@ -134,13 +134,12 @@ class EntityResource extends ResourceBase {
}
// Overwrite the received properties.
+ $langcode_key = $entity->getEntityType()->getKey('langcode');
foreach ($entity->_restPatchFields as $field_name) {
$field = $entity->get($field_name);
// It is not possible to set the language to NULL as it is automatically
// re-initialized. As it must not be empty, skip it if it is.
- // @todo: Use the langcode entity key when available. See
- // https://drupal.org/node/2143729.
- if ($field_name == 'langcode' && $field->isEmpty()) {
+ if ($field_name == $langcode_key && $field->isEmpty()) {
continue;
}
if ($field->isEmpty() && !$original_entity->get($field_name)->access('delete')) {