From 64ae357bddc278cfa9ee0ed6ab4b1a27ae659dd9 Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Sun, 4 Sep 2016 20:44:53 +0300 Subject: [PATCH] Prevent notice on create new content --- src/MembershipManager.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/MembershipManager.php b/src/MembershipManager.php index a8a87e5f1..a6ac1730a 100644 --- a/src/MembershipManager.php +++ b/src/MembershipManager.php @@ -167,6 +167,12 @@ public function getGroupIds(EntityInterface $entity, $group_type_id = NULL, $gro continue; } + $values = $entity->get($field->getName())->getValue(); + if (empty($values[0])) { + // Entity doesn't reference any groups. + continue; + } + // Compile a list of group target IDs. $target_ids = array_map(function ($value) { return $value['target_id'];