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.
We've installed OG Vocabulary and tried to follow the setup instructions to the letter. We have five groups, each with one vocabulary, and one content type that has an OG Vocab Entity Reference field. It all works beautifully unless we attach a file to the content type. Then, at save, we're told that the OG Vocabulary term is required - for every group. The field is not required, which makes it all the more odd. Without an attachment, there is no problem.
Any thoughts?
Comment | File | Size | Author |
---|
Comments
Comment #1
syastrov CreditAttribution: syastrov commentedWhen the upload button of a File field is clicked, in addition to uploading the file, the form is rebuilt underneath.
But when being rebuilt, it doesn't know which group the form belongs to, so it falls back on including vocabulary fields for all of the groups the user belongs to (which, in the case of the admin user is every single group), although you cannot see them until you submit the form and the page is reloaded.
When the form is finally is finally submitted, it tries to validate all of these vocabulary fields (not just the one for the current group), some of which may be required.
I have made a patch which adds an og_context handler for the 'file/ajax' path, which is called when a file is uploaded. This gets the group context from the $_SESSION. I think that there could be a way to pull this from the form itself or perhaps from the query string instead. This way, when the form is rebuilt, it only includes the correct vocabulary field for the group connected with the form.
Comment #2
syastrov CreditAttribution: syastrov commentedComment #3
syastrov CreditAttribution: syastrov commentedThis issue is related to the way Organic Groups og_context module handles file upload.
See Make OG Context aware to parent form in file upload ajax calls.
Comment #4
syastrov CreditAttribution: syastrov commented