Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Say i have a view page at /my_url/%group/MY_VIEW, and i have group context in my page for a block, which appears at /my_url/*/*. Now if we go to correct url ie., /my_url/%group/MY_VIEW , then everything works fine. But when i go to /my_url/%group/NOT_MY_VIEW, then the GroupCacheContext gives the exception that
Error: Call to a member function bundle() on null in modules/contrib/group/src/Cache/Context/GroupCacheContext.php
I have traced the problem to this function, getGroupFromRoute() from trait: GroupRouteContextTrait
Comment | File | Size | Author |
---|---|---|---|
#2 | group-cache-context-2882102-2.patch | 750 bytes | kducharm |
|
Comments
Comment #2
kducharm CreditAttribution: kducharm at CivicActions for Acquia commentedI came across a similar issue of:
when using a relationship on a view to a "Content Group Content". See if the attached patched resolves the issue there, this is similar to what is done in the GroupMembershipCacheContext getContext() function - to check if it has a group before trying to call methods on it.
Comment #3
Jaypan CreditAttribution: Jaypan commentedPatch works for me. Thanks!
Comment #4
kristiaanvandeneyndeGroupCacheContext is deprecated and will be removed in 8.1.0. Please reopen a new issue in case this still occurs with RouteGroupCacheContext. Thanks for the patch though and I'm sorry it took me this long to get around to reviewing it.