Skip to content

Instantly share code, notes, and snippets.

@wimleers
Created April 9, 2013 13:40
Show Gist options
  • Save wimleers/5345754 to your computer and use it in GitHub Desktop.
Save wimleers/5345754 to your computer and use it in GitHub Desktop.
In-place editing for all entity types, not just nodes :)
diff --git a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php
index 9eac5bc..a66ef05 100644
--- a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php
+++ b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php
@@ -41,10 +41,7 @@ public function access(Route $route, Request $request) {
* Implements EntityFieldAccessCheckInterface::accessEditEntityField().
*/
public function accessEditEntityField(EntityInterface $entity, $field_name) {
- $entity_type = $entity->entityType();
- // @todo Generalize to all entity types once http://drupal.org/node/1862750
- // is done.
- return ($entity_type == 'node' && node_access('update', $entity) && field_access('edit', $field_name, $entity_type, $entity));
+ return $entity->access('update') && field_access('edit', $field_name, $entity_type, $entity);
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment