You are here

public function CalendarController::duplicateNode in Content Planner 8

Duplicate Node.

Parameters

\Drupal\node\NodeInterface $node:

Return value

\Symfony\Component\HttpFoundation\RedirectResponse

Throws

\Drupal\Core\Entity\EntityStorageException

1 string reference to 'CalendarController::duplicateNode'
content_calendar.routing.yml in modules/content_calendar/content_calendar.routing.yml
modules/content_calendar/content_calendar.routing.yml

File

modules/content_calendar/src/Controller/CalendarController.php, line 269

Class

CalendarController
Class CalendarController.

Namespace

Drupal\content_calendar\Controller

Code

public function duplicateNode(NodeInterface $node) {
  $duplicate = $node
    ->createDuplicate();
  $duplicate
    ->setTitle($duplicate
    ->getTitle() . ' clone');
  $duplicate
    ->save();
  $destination = \Drupal::destination()
    ->get();
  return new RedirectResponse($destination);
}