If using #access = FALSE on the form, after ajax requests (e.g. remove image), groups can be gone.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

Status: Active » Needs review
FileSize
2 KB
amitaibu’s picture

Status: Needs review » Fixed

Committed.

rbrandon’s picture

Status: Fixed » Needs review
FileSize
634 bytes

The above patch breaks node creation when hiding fields.
Not sure if this is the correct longterm solution but this fixes the issue in both scenarios.

-RB

amitaibu’s picture

> The above patch breaks node creation when hiding fields.

I wasn't able to reproduce on a clean installation, what are the steps?

+++ b/entityreference_prepopulate.moduleundefined
@@ -153,7 +153,7 @@ function entityreference_prepopulate_field_access($op, $field, $entity_type, $en
+    return ($settings['action'] == 'hide' && empty($entity->is_new)) ? FALSE : NULL;

I'm not clear about this fix, as we are already inside if ($id) which means this entity is already saved.

amitaibu’s picture

FileSize
865 bytes

@rbrandon, I understand now your patch, sorry - I've tested it with admin user, so field_access() didn't kick in.

Here's a patch to fix the issue, we'll add a test as-well as follow-up.

amitaibu’s picture

Status: Needs review » Fixed

Committed. The tests would be in another issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.