You are here

public function WebformVariantDuplicateForm::buildForm in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Form/WebformVariantDuplicateForm.php \Drupal\webform\Form\WebformVariantDuplicateForm::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_variant: The webform variant ID.

Return value

array The form structure.

Throws

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

Overrides WebformVariantAddForm::buildForm

File

src/Form/WebformVariantDuplicateForm.php, line 16

Class

WebformVariantDuplicateForm
Provides a duplicate form for webform variant.

Namespace

Drupal\webform\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, WebformInterface $webform = NULL, $webform_variant = NULL) {
  $form = parent::buildForm($form, $form_state, $webform, $webform_variant);
  $form['#title'] = $this
    ->t('Duplicate @label variant', [
    '@label' => $this->webformVariant
      ->label(),
  ]);
  return $form;
}