open_social icon indicating copy to clipboard operation
open_social copied to clipboard

Issue #3455464 - Transform GroupMembershipRequestForm to extend the ContentEntityForm, so we can use field API instead of a custom form

Open nkoporec opened this issue 8 months ago • 5 comments

Problem

In issue https://www.drupal.org/project/social/issues/3453509 we discussed removing the hook to automatically add the field_grequest_message. In order for that change to work we also need to remove any "hard-coded" assumptions that this field exist, since the hook will be remove we can no longer assume that the field will always be there.

This is a breaking change.

Solution

In https://github.com/goalgorilla/open_social/pull/3923 the idea from @Kingdutch was to refactor and use ContentEntityForm as base. We need to change from FormBase to ContentEntityForm and also update the controller to load the entity form. I also created a new entity form definition since our logic requires a bit of a different flow then the join-group defined by the group_content entity, instead of writing a hook_form_alter for this, I opted to just define a new entity form type and use that in the controller.

Issue tracker

https://www.drupal.org/project/social/issues/3455464

Theme issue tracker

How to test

  1. Create a new group type and set the option to request to join for all users.
  2. As a seperate user request the access to join the group and write a request message
  3. As the group admin check if any request has been made and verify that the message is present.

Screenshots

Release notes

Refactored the GroupMembershipRequestForm to use the ContentEntityForm, this gives us to option to use the field API from core.

Change Record

Translations

nkoporec avatar Jun 18 '24 15:06 nkoporec