You are here

function simplenews_scheduler_clone_node in Simplenews Scheduler 8

Same name and namespace in other branches
  1. 7 simplenews_scheduler.module \simplenews_scheduler_clone_node()
  2. 2.0.x simplenews_scheduler.module \simplenews_scheduler_clone_node()

Function clones a node from the given template newsletter node.

1 call to simplenews_scheduler_clone_node()
_simplenews_scheduler_new_edition in ./simplenews_scheduler.module
Create a new newsletter edition based on the master edition of this newsletter.

File

./simplenews_scheduler.module, line 539
Simplenews Scheduler module allows a schedule to be set for sending (and resending) a Simplenews item.

Code

function simplenews_scheduler_clone_node(NodeInterface $node) {
  if ($node
    ->id() > 0) {
    $clone = $node
      ->createDuplicate();

    // Add an extra property as a flag.
    $clone->clone_from_original_nid = $node
      ->id();
    $clone
      ->save();
    return $clone;
  }
}