You are here

public function WebformEntityAddForm::buildForm in Webform 8.5

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

Return value

array The form structure.

Overrides EntityForm::buildForm

File

src/WebformEntityAddForm.php, line 70

Class

WebformEntityAddForm
Provides a webform add form.

Namespace

Drupal\webform

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\webform\WebformInterface $webform */
  $webform = $this
    ->getEntity();

  // Customize title for duplicate webform.
  if ($this->operation === 'duplicate') {

    // Display custom title.
    $form['#title'] = $this
      ->t("Duplicate '@label' form", [
      '@label' => $webform
        ->label(),
    ]);
  }
  $form = parent::buildForm($form, $form_state);
  return $this
    ->buildDialogForm($form, $form_state);
}