function tmgmt_page_attachments in Translation Management Tool 8
Implements hook_page_attachments().
File
- ./
tmgmt.module, line 1282 - Main module file for the Translation Management module.
Code
function tmgmt_page_attachments(array &$attachments) {
// Add CSS for the Translation icon in the toolbar if the user has access to it.
$permissions = [
'administer tmgmt',
'create translation jobs',
'accept translation jobs',
];
foreach ($permissions as $permission) {
if (\Drupal::currentUser()
->hasPermission($permission) && \Drupal::currentUser()
->hasPermission('access toolbar')) {
$attachments['#attached']['library'][] = 'tmgmt/drupal.tmgmt.toolbar';
break;
}
}
}