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

  1. Install ginvite and conditional_fields modules.
  2. Create two fields on the group content invitation entity.
  3. Make the display of one field dependent on the other.
  4. 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.

Comments

jlscott created an issue. See original summary.

jayelless’s picture

Status: Active » Needs review
StatusFileSize
new780 bytes

Patch attached.

lobsterr’s picture

a small improvement

  • LOBsTerr committed b182292 on 2.x
    Issue #3310773 by LOBsTerr, jlscott: Missing $group argument to...
lobsterr’s picture

Status: Needs review » Fixed

Thanks for contribution

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.