public ConfirmFormBase::buildForm(array $form, FormStateInterface $form_state)
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 FormInterface::buildForm
File
- core/lib/Drupal/Core/Form/ConfirmFormBase.php, line 41
Class
- ConfirmFormBase
- Provides an generic base class for a confirmation form.
Namespace
Drupal\Core\Form
Code
public function buildForm(array $form, FormStateInterface $form_state) { $form['#title'] = $this->getQuestion(); $form['#attributes']['class'][] = 'confirmation'; $form['description'] = array('#markup' => $this->getDescription()); $form[$this->getFormName()] = array('#type' => 'hidden', '#value' => 1); $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => $this->getConfirmText(), '#button_type' => 'primary', ); $form['actions']['cancel'] = ConfirmFormHelper::buildCancelLink($this, $this->getRequest()); // By default, render the form using theme_confirm_form(). if (!isset($form['#theme'])) { $form['#theme'] = 'confirm_form'; } return $form; }
Please login to continue.