public function WebformConfigEntityDeleteFormBase::buildForm in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Form/WebformConfigEntityDeleteFormBase.php \Drupal\webform\Form\WebformConfigEntityDeleteFormBase::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/
Form/ WebformConfigEntityDeleteFormBase.php, line 130
Class
- WebformConfigEntityDeleteFormBase
- Provides a generic base class for a webform entity deletion form.
Namespace
Drupal\webform\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['#attributes']['class'][] = 'confirmation';
$form['#theme'] = 'confirm_form';
$form[$this
->getFormName()] = [
'#type' => 'hidden',
'#value' => 1,
];
// Title.
$form['#title'] = $this
->getQuestion();
// Warning.
$form['warning'] = $this
->getWarning();
// Description.
$form['description'] = $this
->getDescription();
// Details and confirm input.
$details = $this
->getDetails();
$confirm_input = $this
->getConfirmInput();
if ($details) {
$form['details'] = $details;
}
if (!$details && $confirm_input) {
$form['hr'] = [
'#markup' => '<p><hr/></p>',
];
}
if ($confirm_input) {
$form['confirm'] = $confirm_input;
}
// Dialog.
return $this
->buildDialogConfirmForm($form, $form_state);
}