Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Pass membership data in form_state for roles add/remove form. #750

Closed

Conversation

dipakmdhrm
Copy link
Contributor

@amitaibu
Copy link
Member

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.

@dipakmdhrm
Copy link
Contributor Author

dipakmdhrm commented Oct 13, 2022

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.

og-actions

This is a problem for our proposed implementation because of 2 reasons:

  1. 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.
  2. 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 😅

@amitaibu
Copy link
Member

Having it in the form_state then would be fine 👍

@dipakmdhrm dipakmdhrm changed the title WIP : Pass membership data in form_state for roles add/remove form. Pass membership data in form_state for roles add/remove form. Oct 13, 2022
@dipakmdhrm dipakmdhrm changed the title Pass membership data in form_state for roles add/remove form. WIP - Pass membership data in form_state for roles add/remove form. Oct 13, 2022
@amitaibu
Copy link
Member

@dipakmdhrm this needs more work

@dipakmdhrm
Copy link
Contributor Author

Added examples in og.api.php

@dipakmdhrm dipakmdhrm requested a review from amitaibu September 25, 2023 12:31
Copy link
Member

@amitaibu amitaibu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still WIP?

og.api.php Outdated Show resolved Hide resolved
src/Form/OgChangeMultipleRolesFormBase.php Outdated Show resolved Hide resolved
src/Form/OgChangeMultipleRolesFormBase.php Outdated Show resolved Hide resolved
@dipakmdhrm dipakmdhrm changed the title WIP - Pass membership data in form_state for roles add/remove form. Pass membership data in form_state for roles add/remove form. Sep 26, 2023
@amitaibu
Copy link
Member

@dipakmdhrm can you please work on a PR to fix the Travis errors (against the 8.x-1.x branch)

@dipakmdhrm dipakmdhrm force-pushed the 749-membership-data-in-form_state branch from 399b490 to 92a57ab Compare September 26, 2023 07:30
@dipakmdhrm
Copy link
Contributor Author

@dipakmdhrm can you please work on a PR to fix the Travis errors (against the 8.x-1.x branch)

WIP: #763
@amitaibu

@claudiu-cristea
Copy link
Collaborator

Since https://www.drupal.org/project/og/issues/3467694 was merged into the 8.x-1.x branch, the development has been moved to https://www.drupal.org/project/og. If this change is still actual, please open an issue at https://www.drupal.org/project/issues/og and provide there a merge request similar with this pull request.

Thank you for contributing to Organic groups module.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants