You are here

public function WebformHandlerAddForm::buildForm in Webform 8.5

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

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

\Drupal\webform\WebformInterface $webform: The webform.

string $webform_handler: The webform handler ID.

Return value

array The form structure.

Throws

\Symfony\Component\HttpKernel\Exception\NotFoundHttpException Throws not found exception if the number of handler instances for this webform exceeds the handler's cardinality.

Overrides WebformHandlerFormBase::buildForm

1 call to WebformHandlerAddForm::buildForm()
WebformHandlerDuplicateForm::buildForm in src/Form/WebformHandlerDuplicateForm.php
Form constructor.
1 method overrides WebformHandlerAddForm::buildForm()
WebformHandlerDuplicateForm::buildForm in src/Form/WebformHandlerDuplicateForm.php
Form constructor.

File

src/Form/WebformHandlerAddForm.php, line 58

Class

WebformHandlerAddForm
Provides an add form for webform handler.

Namespace

Drupal\webform\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, WebformInterface $webform = NULL, $webform_handler = NULL) {
  $form = parent::buildForm($form, $form_state, $webform, $webform_handler);

  // Throw access denied is handler is excluded.
  if ($this->webformHandler
    ->isExcluded()) {
    throw new AccessDeniedHttpException();
  }
  $form['#title'] = $this
    ->t('Add @label handler', [
    '@label' => $this->webformHandler
      ->label(),
  ]);
  return $form;
}