You are here

public function FlexsliderDeleteForm::buildForm in Flex Slider 8.2

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/FlexsliderDeleteForm.php, line 55

Class

FlexsliderDeleteForm
Builds the form to delete Flexslider optionset entities.

Namespace

Drupal\flexslider\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  if ($this->entity
    ->id() == 'default') {
    $form['#title'] = $this
      ->t('The default optionset cannot be deleted.');
    $form['description'] = [
      '#markup' => t('Please click Cancel to go back to the list of optionsets.'),
    ];
    $form['actions']['submit']['#access'] = FALSE;
  }
  return $form;
}