You are here

function opigno_simple_ui_menu_alter in Opigno 7

Same name and namespace in other branches
  1. 7.0 modules/opigno_simple_ui/opigno_simple_ui.module \opigno_simple_ui_menu_alter()

Implements hook_menu_alter().

File

modules/simple_ui/opigno_simple_ui.module, line 190

Code

function opigno_simple_ui_menu_alter(&$items) {

  // Change the default node tabs title on a course node.
  unset($items['node/%node/view']['title']);
  $items['node/%node/view']['title callback'] = 'opigno_simple_ui_course_view_tab_title';
  $items['node/%node/view']['title arguments'] = array(
    1,
  );
  unset($items['node/%node/edit']['title']);
  $items['node/%node/edit']['title callback'] = 'opigno_simple_ui_course_edit_tab_title';
  $items['node/%node/edit']['title arguments'] = array(
    1,
  );
  unset($items['node/%/group']['title']);
  $items['node/%/group']['title callback'] = 'opigno_simple_ui_course_group_tab_title';
  $items['node/%/group']['title arguments'] = array(
    1,
  );

  // Add a new secondary tab "Members".
  $items['node/%/group/users'] = $items['group/%/%/admin/people'];
  $items['node/%/group/users']['title'] = "Members";
  $items['node/%/group/users']['title callback'] = 't';
  unset($items['node/%/group/users']['title arguments']);
  $items['node/%/group/users']['page arguments'][0] = 'node';
  $items['node/%/group/users']['page arguments'][1] = 1;
  $items['node/%/group/users']['access arguments'][1] = 'node';
  $items['node/%/group/users']['access arguments'][2] = 1;
  $items['node/%/group/users']['type'] = MENU_DEFAULT_LOCAL_TASK;

  // Make parent inherit this access control.
  $items['node/%/group']['access callback'] = $items['node/%/group/users']['access callback'];
  $items['node/%/group']['access arguments'] = $items['node/%/group/users']['access arguments'];

  // Add a new secondary tab "Add members".
  $items['node/%/group/add'] = $items['group/%/%/admin/people/add-user'];
  $items['node/%/group/add']['page arguments'][1] = 'node';
  $items['node/%/group/add']['page arguments'][2] = 1;
  $items['node/%/group/add']['access arguments'][1] = 'node';
  $items['node/%/group/add']['access arguments'][2] = 1;
  $items['node/%/group/add']['type'] = MENU_LOCAL_TASK;
  if (isset($items['group/%/%/admin/people/mass-add-user'])) {

    // Add a new secondary tab "Add multiple members".
    $items['node/%/group/mass-add'] = $items['group/%/%/admin/people/mass-add-user'];
    $items['node/%/group/mass-add']['title'] = "Add multiple members";
    $items['node/%/group/mass-add']['page arguments'][1] = 'node';
    $items['node/%/group/mass-add']['page arguments'][2] = 1;
    $items['node/%/group/mass-add']['access arguments'][1] = 'node';
    $items['node/%/group/mass-add']['access arguments'][2] = 1;
    $items['node/%/group/mass-add']['type'] = MENU_LOCAL_TASK;
  }

  // Make parent tab point to "Members" page.
  $items['node/%/group']['page callback'] = $items['node/%/group/users']['page callback'];
  $items['node/%/group']['page arguments'] = $items['node/%/group/users']['page arguments'];

  // Correct sort quizzes page title.
  $items['node/%node/sort-quizzes']['title'] = t("Sort lessons");
  if (isset($items['group/%/%/admin/permissions'])) {

    // Per group og permissions.
    $items['node/%/group/permissions'] = $items['group/%/%/admin/permissions'];
    $items['node/%/group/permissions']['title arguments'][1] = 'node';
    $items['node/%/group/permissions']['title arguments'][2] = 1;
    $items['node/%/group/permissions']['access arguments'][1] = 'node';
    $items['node/%/group/permissions']['access arguments'][2] = 1;
    $items['node/%/group/permissions']['page arguments'][1] = 'node';
    $items['node/%/group/permissions']['page arguments'][2] = 1;
    $items['node/%/group/permissions']['type'] = MENU_LOCAL_TASK;
    $items['node/%/group/permissions']['weight'] = 10;
  }
}