function media_acquiadam_menu_local_tasks_alter in Media: Acquia DAM 8
Implements hook_menu_local_tasks_alter().
Hides the 'Acquia DAM' tab on the user profile if the user is not viewing their own profile.
File
- ./
media_acquiadam.module, line 64 - Integrates Drupal with Acquia DAM.
Code
function media_acquiadam_menu_local_tasks_alter(&$data, $route_name) {
if ($route_name === 'entity.user.canonical') {
foreach ($data['tabs'][0] as $key => $link) {
$url = $link['#link']['url'];
if ($url
->getRouteName() === 'entity.user.acquiadam_auth') {
if ($url
->getRouteParameters()['user'] != Drupal::currentUser()
->id()) {
unset($data['tabs'][0][$key]);
}
}
}
}
}