You are here

function course_handle_clone in Course 6

Same name and namespace in other branches
  1. 8.3 includes/course.exporting.inc \course_handle_clone()
  2. 8.2 includes/course.exporting.inc \course_handle_clone()
  3. 7.2 includes/course.exporting.inc \course_handle_clone()
  4. 7 includes/course.exporting.inc \course_handle_clone()
  5. 3.x includes/course.exporting.inc \course_handle_clone()

Freeze course objects onto a node if necessary.

1 call to course_handle_clone()
course_nodeapi in ./course.module
Implements hook_nodeapi().

File

includes/course.exporting.inc, line 57

Code

function course_handle_clone($node) {
  if (isset($node->clone_from_original_nid) && ($original = node_load($node->clone_from_original_nid))) {
    $node->course['objects'] = $original->course['objects'];
    switch ($node->course['clone_type']) {
      case 'clone':
        foreach ($node->course['objects'] as &$object_data) {
          $courseObject = course_get_course_object_by_id($object_data->coid);
          $object_data->freeze = $courseObject
            ->freeze();
        }
        break;
      case 'reference':
        break;
      case 'new':
        foreach ($node->course['objects'] as $object_data) {
          unset($object_data->instance);
        }
        break;
    }
  }
}