function ConditionDelete::buildForm

Same name in other branches
  1. 8.x-3.x src/Form/ConditionDelete.php \Drupal\ctools\Form\ConditionDelete::buildForm()

Overrides ConfirmFormBase::buildForm

File

src/Form/ConditionDelete.php, line 74

Class

ConditionDelete
Delete Condition Confirmation Form.

Namespace

Drupal\ctools\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $id = NULL, $tempstore_id = NULL, $machine_name = NULL) {
    $this->tempstore_id = $tempstore_id;
    $this->machine_name = $machine_name;
    $this->id = $id;
    $cached_values = $this->tempstore
        ->get($this->tempstore_id)
        ->get($this->machine_name);
    $form['#title'] = $this->getQuestion($id, $cached_values);
    $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';
    }
    $form['actions'] = [
        '#type' => 'actions',
    ];
    $form['actions'] += $this->actions($form, $form_state);
    return $form;
}