ContentEntityConfirmFormBase::buildForm

public ContentEntityConfirmFormBase::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 EntityForm::buildForm

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
 
  $form['#title'] = $this->getQuestion();
 
  $form['#attributes']['class'][] = 'confirmation';
  $form['description'] = array('#markup' => $this->getDescription());
  $form[$this->getFormName()] = array('#type' => 'hidden', '#value' => 1);
 
  // By default, render the form using theme_confirm_form().
  if (!isset($form['#theme'])) {
    $form['#theme'] = 'confirm_form';
  }
  return $form;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.