You are here

public function WebformHandlerEditForm::buildForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Form/WebformHandlerEditForm.php \Drupal\webform\Form\WebformHandlerEditForm::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

File

src/Form/WebformHandlerEditForm.php, line 17

Class

WebformHandlerEditForm
Provides an edit form for webform handlers.

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);
  $form['#title'] = $this
    ->t('Edit @label handler', [
    '@label' => $this->webformHandler
      ->label(),
  ]);

  // Delete action.
  $url = new Url('entity.webform.handler.delete_form', [
    'webform' => $webform
      ->id(),
    'webform_handler' => $this->webformHandler
      ->getHandlerId(),
  ]);
  $this
    ->buildDialogDeleteAction($form, $form_state, $url);
  return $form;
}