function schools_menu_alter

7.x schools.module schools_menu_alter(&$items)
6.x schools.module schools_menu_alter(&$items)

hook_menu_alter

We want to alter some system menu items, so we can make sure to check our new custom permissions.

File

modules/schools/schools.module, line 362
Schools module.

Code

function schools_menu_alter(&$items) {
  if (!is_array($items)) {
    return;
  }

  foreach ($items as $path => $item) {

    if ($path == 'admin/degrees/edit-degree/%/%') {

      // alter access_callback and arguments to make sure
      // the user is able to edit THIS degree.

      $items [$path]['access_callback'] = 'schools_check_access';
      $items [$path]['access_arguments'] = array(2, 3, 4);

    }


    // The path for editing a group looks like this:
    //    admin/groups/edit-group?group_id=XXX&de_catalog_year=XXX
    if ($path == 'admin/groups/edit-group') {

      $items [$path]['access_callback'] = 'schools_check_access';
      $items [$path]['access_arguments'] = array(2, "request_group_id", "group_catalog_year");

    }

    // The path for editing a course looks like this:
    //    admin/courses/edit-course?course_id=XXX&de_catalog_year=XXX    
    if ($path == 'admin/courses/edit-course') {

      $items [$path]['access_callback'] = 'schools_check_access';
      $items [$path]['access_arguments'] = array(2, "request_course_id", "course_catalog_year");

    }


    // We want to make this a default tab, because we are going to 
    // have our other schools have their own tabs as well.
    if ($path == 'admin/config/school-data') {
      $items [$path]['type'] = MENU_TYPE_DEFAULT_TAB;
      $items [$path]['tab_family'] = 'config_school_settings';
      $items [$path]['page_settings']['tab_title'] = t('Default');
      unset($items [$path]['tab_parent']);

    }


    if ($path == 'admin/edit-advising-settings') {
      $items [$path]['type'] = MENU_TYPE_DEFAULT_TAB;
      $items [$path]['tab_family'] = 'edit_advising_settings';
      $items [$path]['page_settings']['tab_title'] = t('Default');
      unset($items [$path]['tab_parent']);
    }


    if ($path == 'admin/config/course-search') {
      $items [$path]['type'] = MENU_TYPE_DEFAULT_TAB;
      $items [$path]['tab_family'] = 'course_search_settings';
      $items [$path]['page_settings']['tab_title'] = t('Default');
      unset($items [$path]['tab_parent']);
    }


    if ($path == 'admin/config/alerts-settings') {
      $items [$path]['type'] = MENU_TYPE_DEFAULT_TAB;
      $items [$path]['tab_family'] = 'alerts_settings';
      $items [$path]['page_settings']['tab_title'] = t('Default');
      unset($items [$path]['tab_parent']);
    }


    if ($path == 'admin/config/audit-settings') {
      $items [$path]['type'] = MENU_TYPE_DEFAULT_TAB;
      $items [$path]['tab_family'] = 'audit_settings';
      $items [$path]['page_settings']['tab_title'] = t('Default');
      unset($items [$path]['tab_parent']);
    }

    if ($path == 'admin/config/appointments') {
      $items [$path]['type'] = MENU_TYPE_DEFAULT_TAB;
      $items [$path]['tab_family'] = 'appointment_settings';
      $items [$path]['page_settings']['tab_title'] = t('Default');
      unset($items [$path]['tab_parent']);
    }



  } // foreach
}