og
og copied to clipboard
Pass membership data in form_state for roles add/remove form.
#749
I think a better solution is what you proposed in https://github.com/Gizra/og/issues/749
Update the current paths for role add & remove from /group/roles/add & /group/roles/remove to /group/{group}/roles/add/{member} & /group/{group}/roles/remove/{member} respectively. This will allow developers to get the group & member data from path.
I think a better solution is what you proposed in #749
Update the current paths for role add & remove from /group/roles/add & /group/roles/remove to /group/{group}/roles/add/{member} & /group/{group}/roles/remove/{member} respectively. This will allow developers to get the group & member data from path.
Implementing this wouldn't be possible because of use of actions to add/remove roles.
This is a problem for our proposed implementation because of 2 reasons:
- My proposed implementation (
/group/{group}/roles/add/{member}
) only considers addition/removal of roles for just 1 member at a time. However, actions allows user to select multiple members and bulk update roles for them. - Actions (example, publish node, set flag etc.) are supposed to be self contained and are not usually expected to pass data in a next step to some form. Actions are in no way connected to a new form on a new page (like our proposed form at /group/{group}/add/roles) and we need some way to pass the list of selected members to the form. That's why we need tempstore.
I tried to find other modules where something similar was set up in hope I might find a way. But even in other modules (views_bulk_edit for example) tempstore is used.
That unfortunately leaves us with the fallback of passing membership data from form build to form alter for people to be able to use it.
In conclusion: I ended up spending way too much time only to end up with disappointment :sweat_smile:
Having it in the form_state then would be fine :+1:
@dipakmdhrm this needs more work
Added examples in og.api.php
@dipakmdhrm can you please work on a PR to fix the Travis errors (against the 8.x-1.x
branch)
@dipakmdhrm can you please work on a PR to fix the Travis errors (against the
8.x-1.x
branch)
WIP: https://github.com/Gizra/og/pull/763 @amitaibu