You are here

function opigno_learning_path_page_attachments in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x opigno_learning_path.module \opigno_learning_path_page_attachments()

Implements hook_page_attachments().

File

./opigno_learning_path.module, line 215
Contains opigno_learning_path.module.

Code

function opigno_learning_path_page_attachments(array &$page) {
  $route = \Drupal::routeMatch()
    ->getRouteName();
  if ($route == 'entity.group.edit_form') {
    $page['#attached']['library'][] = 'opigno_learning_path/delete';
  }
  if ($route == 'entity.group.canonical') {
    $page['#attached']['library'][] = 'opigno_learning_path/join';
    $page['#attached']['library'][] = 'opigno_learning_path/training_main_page';
    $query = \Drupal::request()->query
      ->all();
    if (!empty($query['force'])) {
      $page['#attached']['library'][] = 'opigno_learning_path/run_force';
    }
  }
  $page['#attached']['library'][] = 'opigno_learning_path/global';
}