- Issue created by @ggj
- Status changed to RTBC
5 months ago 9:57am 3 August 2024
In case there are no links showing up for a particular role (based on group permissions), you cannot create any new links dynamically using hook_group_operations_alter
function hook_group_operations_alter(array &$operations, GroupInterface $group) {
// Make sure there is a button to direct anonymous users to login page
if (\Drupal::currentUser()->isAnonymous()) {
$operations['group-login-join'] = [
'title' => 'Login To Join',
'url' => new Url('user.login'),
'weight' => -1
];
}
}
/src/Plugin/Block/GroupOperationsBlock.php's build() function calls $this->moduleHandler->alter('group_operations', $links, $group); only if $links is not empty. This should be called outside the if condition. See the patch attached.