You are here

function tmgmt_smartling_page_attachments in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 tmgmt_smartling.module \tmgmt_smartling_page_attachments()

Implements hook_page_attachments().

File

./tmgmt_smartling.module, line 725
Contains

Code

function tmgmt_smartling_page_attachments(array &$attachments) {
  $current_user = \Drupal::currentUser();
  if (!$current_user
    ->hasPermission("see smartling messages")) {
    return;
  }
  $firebaseConfigs = \Drupal::getContainer()
    ->get('tmgmt_smartling.firebase_config_manager')
    ->getAvailableConfigs();
  if ($firebaseConfigs) {
    $attachments['#attached']['drupalSettings']['tmgmt_smartling']['firebase']['configs'] = $firebaseConfigs;
    $attachments['#attached']['library'][] = 'tmgmt_smartling/firebase';
    $attachments['#attached']['library'][] = 'tmgmt_smartling/notifications';
  }
}