function EntityConfirmFormBase::buildForm

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php \Drupal\Core\Entity\EntityConfirmFormBase::buildForm()
  2. 10 core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php \Drupal\Core\Entity\EntityConfirmFormBase::buildForm()
  3. 11.x core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php \Drupal\Core\Entity\EntityConfirmFormBase::buildForm()

Overrides EntityForm::buildForm

4 calls to EntityConfirmFormBase::buildForm()
BreakLockForm::buildForm in core/modules/views_ui/src/Form/BreakLockForm.php
Form constructor.
EntityDeleteForm::buildForm in core/lib/Drupal/Core/Entity/EntityDeleteForm.php
Form constructor.
WorkflowDeleteForm::buildForm in core/modules/workflows/src/Form/WorkflowDeleteForm.php
Form constructor.
WorkspaceActivateForm::buildForm in core/modules/workspaces/src/Form/WorkspaceActivateForm.php
Form constructor.
4 methods override EntityConfirmFormBase::buildForm()
BreakLockForm::buildForm in core/modules/views_ui/src/Form/BreakLockForm.php
Form constructor.
EntityDeleteForm::buildForm in core/lib/Drupal/Core/Entity/EntityDeleteForm.php
Form constructor.
WorkflowDeleteForm::buildForm in core/modules/workflows/src/Form/WorkflowDeleteForm.php
Form constructor.
WorkspaceActivateForm::buildForm in core/modules/workspaces/src/Form/WorkspaceActivateForm.php
Form constructor.

File

core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php, line 54

Class

EntityConfirmFormBase
Provides a generic base class for an entity-based confirmation form.

Namespace

Drupal\Core\Entity

Code

public function buildForm(array $form, FormStateInterface $form_state) {
    $form = parent::buildForm($form, $form_state);
    $form['#title'] = $this->getQuestion();
    $form['#attributes']['class'][] = 'confirmation';
    $form['description'] = [
        '#markup' => $this->getDescription(),
    ];
    $form[$this->getFormName()] = [
        '#type' => 'hidden',
        '#value' => 1,
    ];
    // By default, render the form using theme_confirm_form().
    if (!isset($form['#theme'])) {
        $form['#theme'] = 'confirm_form';
    }
    return $form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.