You are here

function course_take_course_menu_access in Course 8.3

Same name and namespace in other branches
  1. 8.2 course.module \course_take_course_menu_access()
  2. 6 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_access_course('take', ) as it only returns a boolean.

Parameters

object $node: The course node.

See also

course_uc_token_values()

File

./course.module, line 156
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
    ->id()])) {

    // Allow modules to restrict menu access to the take course tab.
    $hooks = Drupal::moduleHandler()
      ->invokeAll('course_has_take', $node, $user);
    $courses[$node
      ->id()] = !in_array(FALSE, $hooks);
  }
  return $courses[$node
    ->id()];
}