Problem/Motivation
When the ginvite module is used with the conditional_fields module, then attempts to edit a conditional rule with result in the error message:
The website encountered an unexpected error. Please try again later.
TypeError: Drupal\group\Access\GroupAccessResult::allowedIfHasGroupPermission(): Argument #1 ($group) must be of type Drupal\group\Entity\GroupInterface, null given, called in /home/james/xequals/smartbuild/web/modules/contrib/ginvite/ginvite.module on line 61 in Drupal\group\Access\GroupAccessResult::allowedIfHasGroupPermission() (line 32 of modules/contrib/group/src/Access/GroupAccessResult.php).
This is caused by the hook_form_BASE_FORM_ID_alter() for group_content_form implementation assuming that the form will always be for the creation/edit of a group_content entity.
Steps to reproduce
- Install ginvite and conditional_fields modules.
- Create two fields on the group content invitation entity.
- Make the display of one field dependent on the other.
- Edit the conditional rule once it has been created.
Proposed resolution
Check for a group entity associated with the invitation group content before checking the permission.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | ginvite-3310773-missing-group-argument-3.patch | 1.09 KB | lobsterr |
| #3 | interdiff-2-3.txt | 1 KB | lobsterr |
| #2 | ginvite-3310773-missing-group-argument-2.patch | 780 bytes | jayelless |
Comments
Comment #2
jayelless commentedPatch attached.
Comment #3
lobsterr commenteda small improvement
Comment #5
lobsterr commentedThanks for contribution