Fix the widgets to handle multiple content enabler plugin IDs

Created on 18 June 2020, over 4 years ago
Updated 11 June 2024, 9 months ago

Problem/Motivation

Over at #3152324: Add a getPluginIdsByEntityType() method to src/Plugin/GroupContentEnablerManager β†’ we're dealing with some API changes to Group core to make this module work. In particular, the getPluginIdByEntityType() method we used to stuff into the GroupContentEnablerManager isn't right, since there might be multiple plugins for a given entity/bundle.

Thankfully, there are only 2 places in all of entitygroupfield that were using this method. We're dealing with one of them here:

#3153005: Simplify src/Field/EntityGroupFieldItemList.php β†’ (that's the easy case)

This issue is for the harder case... the GroupSelectorWidget widget. There are a lot of assumptions in this code that a given entity/bundle is only going to have a single content enabler plugin for it.

Proposed resolution

TBD

Remaining tasks

  1. Figure out how this should work if getPluginIdsByEntityType() returns multiple plugins.
  2. Implement the changes.
  3. Add/expand test coverage.
  4. Reviews / refinements.
  5. Commit.

User interface changes

TBD.

API changes

TBD.

πŸ“Œ Task
Status

Needs work

Version

1.0

Component

Widgets

Created by

πŸ‡ΊπŸ‡ΈUnited States dww

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain akalam

    That's our case, we have 2 different plugins for nodes, the default provided by groups gnode sub-module, and a custom one.
    In order to mitigate the issue I'm adding here a patch as starting point, adding a new setting to the widgets to select the plugin id, to use the chosen plugin id instead of the first one. If the plugin id setting is empty, will use the first one for backward compatibility.
    The widget seems to work fine on creating the group content entity, but on listing the existing group contents, is still listing all of them, and not only the group contents of the selected plugin id.

    However, I'm sharing the work in progress just in case it helps to somebody else.

Production build 0.71.5 2024