You are here

protected function WebformHandlerDuplicateForm::prepareWebformHandler in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Form/WebformHandlerDuplicateForm.php \Drupal\webform\Form\WebformHandlerDuplicateForm::prepareWebformHandler()

Overrides WebformHandlerAddForm::prepareWebformHandler

File

src/Form/WebformHandlerDuplicateForm.php, line 25

Class

WebformHandlerDuplicateForm
Provides a duplicate form for webform handler.

Namespace

Drupal\webform\Form

Code

protected function prepareWebformHandler($webform_handler) {
  $webform_handler = clone $this->webform
    ->getHandler($webform_handler);
  $webform_handler
    ->setHandlerId(NULL);

  // Initialize the handler an pass in the webform.
  $webform_handler
    ->setWebform($this->webform);

  // Set the initial weight so this handler comes last.
  $webform_handler
    ->setWeight(count($this->webform
    ->getHandlers()));
  return $webform_handler;
}