Skip to content
Snippets Groups Projects
Commit 89f8769b authored by Amitai Burstein's avatar Amitai Burstein
Browse files

Issue #1812152 by Amitaibu | ezheidtmann: Fixed 'other_groups_ids' value in OG...

Issue #1812152 by Amitaibu | ezheidtmann: Fixed 'other_groups_ids' value in OG reference widget, when entity is new.
parent 74d22835
No related branches found
No related tags found
No related merge requests found
......@@ -65,15 +65,17 @@ function og_field_widget_form(&$form, &$form_state, $field, $instance, $langcode
// Get the "Other group" group IDs.
$target_type = $field['settings']['target_type'];
$entity_gids = og_get_entity_groups($entity_type, $entity);
$entity_gids = !empty($entity_gids[$target_type]) ? $entity_gids[$target_type] : array();
$other_groups_ids = array();
if ($id) {
$entity_gids = og_get_entity_groups($entity_type, $entity);
$entity_gids = !empty($entity_gids[$target_type]) ? $entity_gids[$target_type] : array();
$user_gids = og_get_entity_groups();
$user_gids = !empty($user_gids[$target_type]) ? $user_gids[$target_type] : array();
$user_gids = og_get_entity_groups();
$user_gids = !empty($user_gids[$target_type]) ? $user_gids[$target_type] : array();
$other_groups_ids = array();
$full_diff = array_diff(array_merge($entity_gids, $user_gids), array_intersect($entity_gids, $user_gids));
$other_groups_ids = array_values($full_diff);
$full_diff = array_diff(array_merge($entity_gids, $user_gids), array_intersect($entity_gids, $user_gids));
$other_groups_ids = array_values($full_diff);
}
foreach ($field_modes as $field_mode) {
$mocked_instance = og_get_mocked_instance($instance, $field_mode);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment