function CourseObjectNode::thaw in Course 3.x
Same name and namespace in other branches
- 8.3 modules/course_content/src/Course/Object/CourseObjectNode.php \Drupal\course_content\Course\Object\CourseObjectNode::thaw()
- 8.2 modules/course_content/src/Course/Object/CourseObjectNode.php \Drupal\course_content\Course\Object\CourseObjectNode::thaw()
Thaw data frozen from an earlier export/clone.
Parameters
array $data: Unfrozen data.
Return value
int The new instance ID.
Overrides CourseObject::thaw
File
- modules/
course_content/ src/ Course/ Object/ CourseObjectNode.php, line 360
Class
- CourseObjectNode
- A course object that uses a node as a base.
Namespace
Drupal\course_content\Course\ObjectCode
function thaw($ice) {
$node = $ice->node;
unset($node->nid);
unset($node->vid);
// Let other modules do special fixing up.
$context = array(
'method' => 'save-edit',
);
Drupal::moduleHandler()
->alter('clone_node', $node, $context);
node_save($node);
$this
->setInstanceId($node
->id());
return $this
->getInstanceId();
}