function course_handle_clone in Course 3.x
Same name and namespace in other branches
- 8.3 includes/course.exporting.inc \course_handle_clone()
- 8.2 includes/course.exporting.inc \course_handle_clone()
- 6 includes/course.exporting.inc \course_handle_clone()
- 7.2 includes/course.exporting.inc \course_handle_clone()
- 7 includes/course.exporting.inc \course_handle_clone()
Freeze course objects onto a node if necessary.
File
- includes/
course.exporting.inc, line 65
Code
function course_handle_clone($node) {
if (isset($node->clone_from_original_nid) && ($original = Node::load($node->clone_from_original_nid))) {
$node->course['objects'] = course_get_course($original)
->getObjects();
switch ($node->course['clone_type']) {
case 'reference':
break;
case 'new':
foreach ($node->course['objects'] as $object_data) {
unset($object_data->instance);
}
break;
case 'clone':
default:
foreach ($node->course['objects'] as $object_data) {
$courseObject = course_get_course_object_by_id($object_data->coid);
if ($courseObject
->getCloneAbility() === FALSE) {
unset($object_data->instance);
}
$object_data->freeze = $courseObject
->freeze();
}
break;
}
}
}