function ContentEntityConfirmFormBase::buildForm

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

Overrides EntityForm::buildForm

2 calls to ContentEntityConfirmFormBase::buildForm()
ContentEntityDeleteForm::buildForm in core/lib/Drupal/Core/Entity/ContentEntityDeleteForm.php
Form constructor.
UserCancelForm::buildForm in core/modules/user/src/Form/UserCancelForm.php
Form constructor.
2 methods override ContentEntityConfirmFormBase::buildForm()
ContentEntityDeleteForm::buildForm in core/lib/Drupal/Core/Entity/ContentEntityDeleteForm.php
Form constructor.
UserCancelForm::buildForm in core/modules/user/src/Form/UserCancelForm.php
Form constructor.

File

core/lib/Drupal/Core/Entity/ContentEntityConfirmFormBase.php, line 52

Class

ContentEntityConfirmFormBase
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.