You are here

function cas_menu_links_discovered_alter in CAS 2.x

Same name and namespace in other branches
  1. 8 cas.module \cas_menu_links_discovered_alter()

Implements hook_menu_links_discovered_alter().

File

./cas.module, line 312
Provides CAS authentication for Drupal.

Code

function cas_menu_links_discovered_alter(&$links) {

  // The "admin toolbar tools" module adds a "Add a new user" menu item to
  // the "People" admin menu. Here we supplement that with one for adding
  // CAS users as well. We could also just add this via cas.links.menu.yml,
  // but we only want it to appear if the admin toolbar tools module is also
  // enabled.
  if (\Drupal::moduleHandler()
    ->moduleExists('admin_toolbar_tools')) {
    $links['cas.bulk_add_users'] = [
      'title' => t('Add CAS user(s)'),
      'provider' => 'cas',
      'route_name' => 'cas.bulk_add_cas_users',
      'menu_name' => 'admin',
      'parent' => 'entity.user.collection',
      'weight' => -1,
    ];
  }
}