You are here

public function CustomFilterDeleteForm::buildForm in Custom filter 2.0.x

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

src/Form/CustomFilterDeleteForm.php, line 45

Class

CustomFilterDeleteForm
Builds the form to delete a Custom Filter.

Namespace

Drupal\customfilter\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  if ($warning = $this->customFilterValidator
    ->validateFilter($this->entity)) {
    $form['warning'] = [
      '#prefix' => '<div>',
      '#markup' => $warning,
      '#suffix' => '</div>',
    ];
    $form['validation'] = [
      '#prefix' => '<div>',
      '#markup' => $this
        ->t("Continue the operation to delete the filter and it's usage in text formats."),
      '#suffix' => '</div>',
    ];
    $form['description']['#prefix'] = '<div><br/>';
    $form['description']['#suffix'] = '</div>';
    $form['description']['#weight'] = 10;
  }
  return $form;
}