The "Primary" and "Secondary" fields are a bad concept, and it's reflected in the amount of code needed for it.

Work is undergoing in branch 1730678 to replace it with a "complex" widget.

Node edit:
Edit Post test | Site-Install.jpg

Field settings -- Remove all the confusing config, in favor of just selecting the widget types:
Groups audience | Site-Install.jpg

Files: 
CommentFileSizeAuthor
#15 Selection_056.png5.45 KBjhedstrom
#12 1730678-og-complex-widget-10.patch69.45 KBAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 864 pass(es).
[ View ]
#6 1730678-complex-widget-6.patch69.98 KBAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 866 pass(es).
[ View ]
Groups audience | Site-Install.jpg29.33 KBAmitaibu
Edit Post test | Site-Install.jpg17.99 KBAmitaibu

Comments

Issue summary:View changes

Updated issue summary.

Anyone around to help me with upgrading the tests? :)

Is it available in latest dev?

Work is undergoing in branch 1730678

I tested another way to build a nice widget to set content to one or more groups....
Autocomplete Deluxe module! Works fine! Also with tag style! So groups can added and removed a nice way to content.

What is missing is a widget to add other users a simple and nice way to one or more (own) groups ;)

Issue summary:View changes

Updated issue summary.

Is this just waiting on your patch being committed to ctools, or are there still specific problems with the new widget that need work?

Thanks for this. It's very exciting; should make things much better!

StatusFileSize
new69.98 KB
PASSED: [[SimpleTest]]: [MySQL] 866 pass(es).
[ View ]

Patch for make file

Testing out the patch in #6, one bit of feedback is that this is still confusing for administrators when there is an entityreference prepopulate widget in play, since this fails to populate the new widget if the administer is not part of the group.

Also, unless I've misconfigured my widget, I'm getting ajax errors due to this code in og_entityreference_autocomplete_callback() always returning access denied (throwing a browser error since this isn't returned as json) for groups the administrator is not a member of.

  if ($entity_id !== 'NULL') {
    $entity = entity_load_single($entity_type, $entity_id);
    if (!$entity || !entity_access('view', $entity_type, $entity)) {
      return MENU_ACCESS_DENIED;
    }
  }

since this fails to populate the new widget if the administer is not part of the group

I'm getting ajax errors due to this code

I believe you, but I can't reproduce. It's seems to work fine with ER_prepopulate.

Oh, I understand now what you mean about #8, I'll look into it.

Actually I don't, re-checked, and works ok ;)

Status:Needs work» Needs review
StatusFileSize
new69.45 KB
PASSED: [[SimpleTest]]: [MySQL] 864 pass(es).
[ View ]

And here's the patch for testbot.

btw, no longer depends on #1707810: Allow mockup field settings in ctools_field_invoke_field()

Issue summary:View changes

Updated issue summary.

Status:Needs review» Fixed

and ... committed!

Status:Fixed» Needs review

When trying to edit *any* og content, an exception is thrown since $other_groups_ids is always false, thus $valid_ids is always empty.

          // Keep only the hidden group IDs on the entity, so they won't
          // appear again on the "admin" field, for example on an autocomplete
          // widget type.
          $valid_ids = $other_groups_ids ? entityreference_get_selection_handler($field, $mocked_instance, $entity_type, $dummy_entity)->validateReferencableEntities($other_groups_ids) : array();
          $valid_ids = $field['cardinality'] == 1 ? reset($valid_ids) : $valid_ids;
          $wrapper->{$field_name}->set($valid_ids);

StatusFileSize
new5.45 KB

Also, if I comment out the call to the set() method from #14 to bypass the unhandled exception, when editing, both the 'Default' and the 'Administrator' values are filled in:

Selection_056.png

resulting in this error when saving:

FIELDNAME: this field cannot hold more than 1 values.

This also happens on node creation when using the entityreference prepopulate widget as an administrator.

Status:Needs review» Fixed

@jhedstrom,
Can you please open a new issue for this, but just to answer

> an exception is thrown since $other_groups_ids is always false

That's not right, if I'm a a user that doesn't belong to *all* groups, then $other_group_ids is populated.

Status:Fixed» Closed (fixed)

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

Issue summary:View changes

Updated issue summary.