Problem/Motivation

Opigno Learning Path rewrites Group's views.view.group_members.yml view and adds the group membership status view field handler. However the latter assumes it is always dealing with a learning path row, which might not actually be the case, as this view is used by any group type. Specifically, if the group is not a LP, its memberships may have no status, which triggers the following notice:

Notice: Undefined offset: 0 in Drupal\opigno_learning_path\LearningPathAccess::getMembershipStatus() (line 193 of modules/contrib/opigno_learning_path/src/LearningPathAccess.php).

Proposed resolution

Check the row bundle before running LP-specific logic.

Remaining tasks

  • Validate the proposed solution
  • Write a patch
  • Reviews

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach created an issue. See original summary.

plach’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
659 bytes
axelm’s picture

Hi
The patch will be applied to the next release of Opigno

axelm’s picture

Status: Needs review » Patch (to be ported)
catch’s picture

Status: Patch (to be ported) » Needs review
FileSize
676 bytes

Unfortunately there's a mistake in the patch. The entity being checked is the group membership, so the bundle check should be 'learning_path-group_memberhip'.

plach’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me, thanks!

axelm’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
axelm’s picture

Status: Patch (to be ported) » Fixed
axelm’s picture

Status: Fixed » Closed (fixed)