You are here

function course_take_course_menu_access in Course 7

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. 6 course.module \course_take_course_menu_access()
  4. 7.2 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 string reference to 'course_take_course_menu_access'
course_menu in ./course.module
Implements hook_menu().

File

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

Code

function course_take_course_menu_access($node) {
  global $user;
  $courses =& drupal_static(__FUNCTION__, 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];
}