You are here

function course_object_options in Course 6

Same name and namespace in other branches
  1. 7.2 course.module \course_object_options()
  2. 7 course.module \course_object_options()

Page callback: Handles object options form for both ctools modal and nojs.

Parameters

stdClass $node: A course node object loaded from course_load().

boolean $js: Detects if ajax is enabled, loaded from ctools_js_load().

courseObject $courseObject: A courseObject object, loaded from course_object_load().

1 string reference to 'course_object_options'
course_menu in ./course.module
Implements hook_menu().

File

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

Code

function course_object_options($node, $js, $courseObject) {
  $course = course_get_course($node);
  $courseObject
    ->setCourse($course);
  if ($js) {
    ctools_include('ajax');
    ctools_include('modal');
    $form_state = array(
      'ajax' => TRUE,
      'title' => t("Settings for %t", array(
        '%t' => $courseObject
          ->getTitle(),
      )),
    );
    $form_state['args'][] = $courseObject;
    $output = ctools_modal_form_wrapper('course_object_options_form', $form_state);
    if (empty($output)) {
      $output[] = ctools_modal_command_loading();
      $output[] = ctools_modal_command_dismiss();
    }
    ctools_ajax_render($output);
  }
  else {
    return drupal_get_form('course_object_options_form', $courseObject);
  }
}