protected function WebformHandlerAddForm::prepareWebformHandler in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Form/WebformHandlerAddForm.php \Drupal\webform\Form\WebformHandlerAddForm::prepareWebformHandler()
1 method overrides WebformHandlerAddForm::prepareWebformHandler()
File
- src/
Form/ WebformHandlerAddForm.php, line 48
Class
- WebformHandlerAddForm
- Provides an add form for webform handler.
Namespace
Drupal\webform\FormCode
protected function prepareWebformHandler($webform_handler) {
/** @var \Drupal\webform\Plugin\WebformHandlerInterface $webform_handler */
$webform_handler = $this->webformHandlerManager
->createInstance($webform_handler);
// Initialize the handler an pass in the webform.
$webform_handler
->setWebform($this->webform);
// Set the initial weight so this handler comes last.
$handlers = $this->webform
->getHandlers();
$weight = 0;
foreach ($handlers as $handler) {
if ($weight < $handler
->getWeight()) {
$weight = $handler
->getWeight() + 1;
}
}
$webform_handler
->setWeight($weight);
return $webform_handler;
}