public function WebformVariantAddForm::buildForm in Webform 8.5
Same name and namespace in other branches
- 6.x src/Form/WebformVariantAddForm.php \Drupal\webform\Form\WebformVariantAddForm::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 WebformVariantFormBase::buildForm
1 call to WebformVariantAddForm::buildForm()
- WebformVariantDuplicateForm::buildForm in src/
Form/ WebformVariantDuplicateForm.php - Form constructor.
1 method overrides WebformVariantAddForm::buildForm()
- WebformVariantDuplicateForm::buildForm in src/
Form/ WebformVariantDuplicateForm.php - Form constructor.
File
- src/
Form/ WebformVariantAddForm.php, line 50
Class
- WebformVariantAddForm
- Provides an add form for webform variant.
Namespace
Drupal\webform\FormCode
public function buildForm(array $form, FormStateInterface $form_state, WebformInterface $webform = NULL, $webform_variant = NULL) {
$form = parent::buildForm($form, $form_state, $webform, $webform_variant);
// Throw access denied is variant is excluded.
if ($this->webformVariant
->isExcluded()) {
throw new AccessDeniedHttpException();
}
$form['#title'] = $this
->t('Add @label variant', [
'@label' => $this->webformVariant
->label(),
]);
return $form;
}