I'm using Drupal 9.2.6 with Group module and I want to remove some tabs from local tasks block and rename some of them.
I've created the module and placed above code with hook_menu_local_actions_alter and hook_menu_local_tasks_alter:
function mymodulename_menu_local_actions_alter(&$local_actions) {
$local_actions['view.group_members.page_1']['title'] = t('Users');
}
function pacifica_menu_local_tasks_alter(&$data, $route_name) {
unset($data['tabs'][0]['entity.group_content.collection']);
}
The route names where received from webprofiler.
Seems that code doesn't work - Members tab is not renamed to Users, and All entities tab is not hidden. And yes, I've cleared the caches.
Could someone, please, point me to the right direction in solving this?
composer install drupal/devel_kint_extras && drush -y en devel_kint_extras
, then go into your hook and putksm($variables);
, thendrush cr
and visit the site and it will print you a nicely formatted var_dump into the messages block which by default is placed on some region on the top of the site.