Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The entity reference field widget "OG reference" does not filter on its configured membership type.
Example:
Membership types:
- host
- partners
Entity types:
- node/group
- node/article
- Entity reference field_group_host
- Entity reference field_group_parents
Both fields will contain all memberships, regardless their membership types.
Comment | File | Size | Author |
---|---|---|---|
#20 | 1872016-og-widget-select-20.patch | 3.44 KB | amitaibu |
#15 | new.png | 29.07 KB | casey |
#15 | edit.png | 29.71 KB | casey |
#12 | og-1872016-9.patch | 1.35 KB | casey |
#10 | og-1872016-8.patch | 1.35 KB | casey |
Comments
Comment #1
amitaibuHi casey, long time!
That's indeed a bug. Are you going to work on it? :)
Comment #2
casey CreditAttribution: casey commentedHi to you too, long time indeed!
Couple of questions:
Comment #3
amitaibu> "OG reference" does not filter on its configured membership type.
Re-looking at this, I might have misread it the first time.
Every og-audience field is related to a membership type. Meaning that the type of the membership that is created when a reference is made, can be changed from field to field. What is referenced from the field, can be any entity -- which you can limit via the field's UI, or have your own Entity-reference selection handler.
Is it answering your question?
Comment #4
casey CreditAttribution: casey commentedNo I don't think you have misread it. I ve looked into it some more and only the "OG reference" widget is affected.
This is probably the case because og_field_widget_form() calls og_get_entity_groups() to retrieve its form values.
While normal entiryreference widgets use the form values provided by Entityreference (in this case through OgBehaviorHandler::load())
Still need to test it but I guess this issue is fixed by replacing (in og_field_widget_info())
by
Comment #5
casey CreditAttribution: casey commentedErrr no normal widgets allow you to select any group. I guess you shoudn't use other widgets for OG fields.
Comment #6
casey CreditAttribution: casey commentedStill my solution seems to work
Comment #7
amitaibu> Still my solution seems to work
What solution?
Comment #8
casey CreditAttribution: casey commentedThis one
Comment #10
casey CreditAttribution: casey commentedComment #12
casey CreditAttribution: casey commentedArr
Comment #13
amitaibuSorry. can you attach a screenshot of the problem, I'm not sure I follow.
Comment #14
amitaibubtw, #1865944: Allow implementing modules to change the My/Other groups selection
Comment #15
casey CreditAttribution: casey commented@images
Publisher field has membership type set to "Publisher"
Co-publisher field has membership type set to "C0-publisher"
new.png contains screenshot of what I selected when I created the node.
edit.png contains screenshot of what the widget contains when I edit the node.
Both fields will contain all memberships, regardless their membership types.
@problem
Currently field widget contains all memberships with configured target type and optionaly configured target bundle.
While it should contain all memberships with configured target type and optionaly configured target bundle, and configured membership type.
og_get_entity_groups() does not allow for that.
Comment #16
casey CreditAttribution: casey commentedI didn't understand #1865944: Allow implementing modules to change the My/Other groups selection earlier. That one is about allowing to extend "other groups". That's a feature request while this is a bug.
Comment #17
amitaibuRight, I understand the problem. How about a little test? :)
Comment #18
amitaibubtw, I don't think it's related to membership types -- it's the fact that you have two audience fields on the form
Comment #19
amitaibuI'll give a stab with a test.
Comment #20
amitaibuPatch with test.
Comment #21
amitaibuCommitted, thanks.