diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php index 9c9f8ee..cdf80ce 100644 --- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php +++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php @@ -100,11 +100,9 @@ public function post(EntityInterface $entity = NULL) { // Only check 'edit' permissions for fields that were actually // submitted by the user. Field access makes no difference between 'create' // and 'update', so the 'edit' operation is used here. - if ($entity instanceof FieldableEntityInterface) { - foreach ($entity->_restSubmittedFields as $key => $field_name) { - if (!$entity->get($field_name)->access('edit')) { - throw new AccessDeniedHttpException("Access denied on creating field '$field_name'"); - } + foreach ($entity->_restSubmittedFields as $key => $field_name) { + if (!$entity->get($field_name)->access('edit')) { + throw new AccessDeniedHttpException("Access denied on creating field '$field_name'"); } } @@ -116,13 +114,7 @@ public function post(EntityInterface $entity = NULL) { // 201 Created responses return the newly created entity in the response // body. - if ($entity->getEntityType()->hasLinkTemplate('canonical')) { - $url = $entity->urlInfo('canonical', ['absolute' => TRUE])->toString(TRUE); - } - else { - $url = Url::fromRoute('')->setAbsolute()->toString(TRUE); - } - + $url = $entity->urlInfo('canonical', ['absolute' => TRUE])->toString(TRUE); $response = new ResourceResponse($entity, 201, ['Location' => $url->getGeneratedUrl()]); // Responses after creating an entity are not cacheable, so we add no // cacheability metadata here.