Skip to content

Instantly share code, notes, and snippets.

@EclipseGc
Created May 2, 2014 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EclipseGc/6940120636b1d22af79b to your computer and use it in GitHub Desktop.
Save EclipseGc/6940120636b1d22af79b to your computer and use it in GitHub Desktop.
diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/.EntityResource.php.swp b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/.EntityResource.php.swp
deleted file mode 100644
index efbc9bd..0000000
Binary files a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/.EntityResource.php.swp and /dev/null differ
diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php
index 9b3c792..f373371 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php
@@ -9,6 +9,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageException;
+use Drupal\Core\Field\FieldItemListInterface;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -47,7 +48,7 @@ public function get(EntityInterface $entity) {
throw new AccessDeniedHttpException();
}
foreach ($entity as $field_name => $field) {
- if (!$field->access('view')) {
+ if ($field instanceof FieldItemListInterface && !$field->access('view')) {
unset($entity->{$field_name});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment