Closed (fixed)
Project:
Group
Version:
8.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Apr 2016 at 14:52 UTC
Updated:
30 Mar 2018 at 13:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kristiaanvandeneynde+1 on so many levels :)
I definitely want this in before RC1, but it may be a nice one to tackle once we're in beta.
Comment #3
jludwig commentedThis patch adds 'Members' and 'Nodes' as operations to the group listing page.
Comment #4
zerolab commentedThat looks like a promising start.
It is worth noting that only the memberships plugin is baked into group. Nodes come from the gnode
GroupContentEnablerplugin and, in our case, other entities from custom plugins. As such it would be better to either provide a hook that eachGroupContentEnablerplugin must implement. Or add operations based on$base_plugin_idand the label discovered by the plugin.Comment #5
joachim commented> As such it would be better to either provide a hook that each GroupContentEnabler plugin must implement.
I don't think that or the approach in the patch is needed. IIRC, I've seen other code that provides operations on entities on an entity listing, and it does so by looking at the menu tabs on the entity view: it's automatic.
Comment #6
jludwig commented> I don't think that or the approach in the patch is needed. IIRC, I've seen other code that provides operations on entities on an entity listing, and it does so by looking at the menu tabs on the entity view: it's automatic.
This approach doesn't seem to work in this circumstance. The way this is usually accomplished is through routing that is directly associated with the entity, the routing in this case is actually associated with the group_content entity rather than the group entity.
I did play around with it to see if I could get something to work, but the code ended up being rather messy and would take a change to the plugin that would seem to be more work to get it working than just implementing a hook.
The attached patch uses a core hook to split the operations additions into the appropriate modules. The group membership one could still be added using the getDefaultOperations() method, but I think that this way provides an example on how to add additional operations to people writing their own plugins.
One thing that I do not like about this patch is that type hinting it causes a PHP error because the passed argument could be two different interfaces, but I tried to document that as best I could in the docblock.
Edit: FYI, when I type hinted with EntityInterface, I got the following error on group/{group}/node:
Typehinting with GroupContent ends up with this on the admin groups list:
Comment #7
alan.upstone commented#6 is working well for me. Thanks.
Comment #10
mike.davis commentedHi, the patch from #6 doesn't work correctly with the latest group code. Here is an updated patch which enables this to work.
Comment #11
mike.davis commentedHere is an updated patch which checks for permissions on the user to be able to access the members and node list
Comment #12
mike.davis commentedCouple of tweaks due to various methods now being available on the GroupContentEnablerInterface for the plugin
Comment #13
mike.davis commentedAnother update, so that the `administer group` access is checked to allow access to any administrators regardless of whether they are in the group or not
Comment #14
mike.davis commentedHere is another update which handles the check for the permissions of a user within a group better
Comment #15
kristiaanvandeneyndeLooks good, thanks all!
Applied is an updated patch which does not require a plugin to be installed for the Nodes tab to show up (as it's permission based) and adds tests.
Comment #16
kristiaanvandeneynde