Enable Organic groups on media types

Created on 28 February 2024, over 1 year ago

Problem/Motivation

Add a field to each of the media item types to allow users to assign the item to a Group so that:

If an item is assigned to a group

the item is not able to be found in the library, selected or edited by someone who is not a member of that group

Similar to article pages, only members of a group can add new items to that group (the select list field to add to a group only shows the list of that user’s groups)

Media items not assigned to any groups should remain subject to drupal’s overall permissions in terms of who can create/update/delete those items.

Proposed resolution

Add media types to the og_ui_form_alter

Feature request
Status

Active

Version

1.0

Component

og.module

Created by

🇵🇭Philippines ambot112

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ambot112
  • Status changed to Needs review about 1 year ago
  • 🇺🇸United States damienmckenna NH, USA

    I wonder if there's a better way of doing it with BundleEntityFormBase rather than specifically hardcoding for MediaTypeForm?

  • 🇺🇸United States damienmckenna NH, USA

    A smaller PR.

  • Status changed to Needs work 26 days ago
  • 🇦🇷Argentina dagmar Argentina

    I had to remove the instanceof check from Drupal\og_ui\BundleEntityFormAlter::formAlter(array &$form, FormStateInterface $form_state): void

    In order to make patch #3 work.

        if (!$form_state->getFormObject() instanceof BundleEntityFormBase) {
          throw new \InvalidArgumentException('Passed in form is not a bundle entity form.');
        }
        static::prepare($form);
    

    I'm pretty sure this check has a purpose but it was preventing showing the checkbox for media entities in my case.

Production build 0.71.5 2024