You are here

function varbase_total_control_page_attachments in Varbase Total Control Dashboard 8

Same name and namespace in other branches
  1. 8.6 varbase_total_control.module \varbase_total_control_page_attachments()
  2. 8.5 varbase_total_control.module \varbase_total_control_page_attachments()
  3. 9.0.x varbase_total_control.module \varbase_total_control_page_attachments()

Implements hook_element_info_alter().

File

./varbase_total_control.module, line 11

Code

function varbase_total_control_page_attachments(array &$attachments) {
  $routers = [
    'page_manager.page_view_total_control_dashboard_total_control_dashboard-panels_variant-1',
    'page_manager.page_view_total_control_dashboard_total_control_dashboard-panels_variant-0',
  ];
  if (in_array(\Drupal::routeMatch()
    ->getRouteName(), $routers)) {

    // Attach our extra CSS for Varbase dashboard.
    $attachments['#attached']['library'][] = 'varbase_total_control/vtc';
    $moduleHandler = \Drupal::service('module_handler');
    if ($moduleHandler
      ->moduleExists('masonry')) {
      $attachments['#attached']['library'][] = 'varbase_total_control/vtc-masonry';
    }
  }
}