I have a custom block that is displayed within each group on every page. The block visibility is set to /league/*
The custom block shows up fine for /league/{gid}, /league/{gid}/members, /league/{gid}/edit, /league/{gid}/invitations etc.
I created a custom form with a route of /league/{gid}/segments, but my block is not rendering correctly on that page because of this line in my block:
if (($group = $this->getContextValue('group')) && $group->id()) {
I got that line from the group module /src/Plugin/Block/GroupOperationsBlock.php
$this->getContextValue('group')) is not defined.
How can I pass the group context to that form page? I tried adding the options of group to the route like this, but no luck:
mymodule.segments:   path: '/league/{gid}/segments'   defaults:     _title: 'Segments'     _form: 'DrupalmymoduleFormSegmentsForm'   requirements:     _permission: 'authenticated'   options:     parameters:       group:         type: 'entity:group' 
Any ideas?