core/modules/rdf/rdf.module | 3 ++- .../rest/src/Plugin/rest/resource/EntityResource.php | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index 33a3e92..ceda758 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -233,8 +233,9 @@ function rdf_comment_storage_load($comments) { $created_mapping = rdf_get_mapping('comment', $comment->bundle()) ->getPreparedFieldMapping('created'); $comment->rdf_data['date'] = rdf_rdfa_attributes($created_mapping, $comment->get('created')->first()->toArray()); + /** @var \Drupal\Core\Entity\EntityInterface $entity */ $entity = $comment->getCommentedEntity(); - $comment->rdf_data['entity_uri'] = $entity->url(); + $comment->rdf_data['entity_uri'] = $entity->toUrl()->toString(TRUE)->getGeneratedUrl(); if ($comment->hasParentComment()) { $comment->rdf_data['pid_uri'] = $comment->getParentComment()->url(); } diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php index a2d712d..27d69eb 100644 --- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php +++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php @@ -145,13 +145,21 @@ public function patch(EntityInterface $original_entity, EntityInterface $entity } // Overwrite the received properties. - $langcode_key = $entity->getEntityType()->getKey('langcode'); + $entity_keys = array_values($entity->getEntityType()->getKeys()); foreach ($entity->_restSubmittedFields 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. - if ($field_name == $langcode_key && $field->isEmpty()) { - continue; + + // Entity key fields need special treatment. + if (in_array($field_name, $entity_keys)) { + // Unchanged Values for entity keys same don't need access checking. + if ($original_entity->get($field_name)->getValue() === $entity->get($field_name)->getValue()) { + continue; + } + // 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. + else if (isset($entity_keys['langcode']) && $field_name === $entity_keys['langcode'] && $field->isEmpty()) { + continue; + } } if (!$original_entity->get($field_name)->access('edit')) {