You are here

function course_take_course_menu_access in Course 6

Same name and namespace in other branches
  1. 8.3 course.module \course_take_course_menu_access()
  2. 8.2 course.module \course_take_course_menu_access()
  3. 7.2 course.module \course_take_course_menu_access()
  4. 7 course.module \course_take_course_menu_access()
  5. 3.x course.module \course_take_course_menu_access()

Menu access callback to determins if the take course button should display on the course node.

This differs from course_take_course_access() as it only returns a boolean.

Parameters

object $node: The course node.

See also

course_uc_token_values()

1 call to course_take_course_menu_access()
course_uc_token_values in modules/course_uc/course_uc.module
Implements hook_token_values().
1 string reference to 'course_take_course_menu_access'
course_menu in ./course.module
Implements hook_menu().

File

./course.module, line 656
course.module Core functionality for Courses.

Code

function course_take_course_menu_access($node) {
  global $user;
  static $courses = array();
  if (!isset($courses[$node->nid])) {

    // Allow modules to restrict menu access to the take course tab.
    $hooks = module_invoke_all('course_has_takecourse', $node, $user);
    $courses[$node->nid] = !in_array(FALSE, $hooks);
  }
  return $courses[$node->nid];
}