You are here

public function WorkflowDeleteForm::buildForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workflows/src/Form/WorkflowDeleteForm.php \Drupal\workflows\Form\WorkflowDeleteForm::buildForm()

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 EntityConfirmFormBase::buildForm

File

core/modules/workflows/src/Form/WorkflowDeleteForm.php, line 19

Class

WorkflowDeleteForm
Builds the form to delete Workflow entities.

Namespace

Drupal\workflows\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  if ($this->entity
    ->getTypePlugin()
    ->workflowHasData($this->entity)) {
    $form['#title'] = $this
      ->getQuestion();
    $form['description'] = [
      '#markup' => $this
        ->t('This workflow is in use. You cannot remove this workflow until you have removed all content using it.'),
    ];
    return $form;
  }
  return parent::buildForm($form, $form_state);
}