function CourseObjectNode::preSave 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::preSave()
- 8.2 modules/course_content/src/Course/Object/CourseObjectNode.php \Drupal\course_content\Course\Object\CourseObjectNode::preSave()
Clone a node before saving.
Overrides ContentEntityBase::preSave
File
- modules/
course_content/ src/ Course/ Object/ CourseObjectNode.php, line 310
Class
- CourseObjectNode
- A course object that uses a node as a base.
Namespace
Drupal\course_content\Course\ObjectCode
function preSave(EntityStorageInterface $storage, $update = TRUE) {
if ($this
->getOption('clone_and_reference')) {
module_load_include('inc', 'clone', 'clone.pages');
$new_nid = clone_node_save($this
->getOption('instance'));
$this
->setInstanceId($new_nid);
$this
->setOption('clone_and_reference', 0);
}
parent::preSave($storage, $update);
}