open_social
open_social copied to clipboard
Issue #3455464 - Transform GroupMembershipRequestForm to extend the ContentEntityForm, so we can use field API instead of a custom form
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
- Create a new group type and set the option to request to join for all users.
- As a seperate user request the access to join the group and write a request message
- 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.