WebformHandlerDuplicateForm.php in Webform 8.5
File
src/Form/WebformHandlerDuplicateForm.php
View source
<?php
namespace Drupal\webform\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\WebformInterface;
class WebformHandlerDuplicateForm extends WebformHandlerAddForm {
public function buildForm(array $form, FormStateInterface $form_state, WebformInterface $webform = NULL, $webform_handler = NULL) {
$form = parent::buildForm($form, $form_state, $webform, $webform_handler);
$form['#title'] = $this
->t('Duplicate @label handler', [
'@label' => $this->webformHandler
->label(),
]);
return $form;
}
protected function prepareWebformHandler($webform_handler) {
$webform_handler = clone $this->webform
->getHandler($webform_handler);
$webform_handler
->setHandlerId(NULL);
$webform_handler
->setWebform($this->webform);
$webform_handler
->setWeight(count($this->webform
->getHandlers()));
return $webform_handler;
}
}