You are here

function CourseObjectNode::thaw in Course 8.3

Same name and namespace in other branches
  1. 8.2 modules/course_content/src/Course/Object/CourseObjectNode.php \Drupal\course_content\Course\Object\CourseObjectNode::thaw()
  2. 3.x 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 354

Class

CourseObjectNode
A course object that uses a node as a base.

Namespace

Drupal\course_content\Course\Object

Code

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();
}