summaryrefslogtreecommitdiffstats
path: root/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
diff options
context:
space:
mode:
authorAlex Pott2014-12-29 22:15:19 +0000
committerAlex Pott2014-12-29 22:15:19 +0000
commitb778bfd1ecafc8cd12d8733d98e2d8cea4d8d975 (patch)
tree446512055908cc45d9a7d26ec1db73ddf061c113 /core/modules/rest/src/Plugin/rest/resource/EntityResource.php
parent847a50ac1c7985e772ea467c89adb7150f6f35f4 (diff)
Issue #2143729 by tstoeckler, plach, jsbalsera, Berdir, mauzeh, damiankloip, andypost: Entity definitions miss a language entity key
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')) {