You are here

public function SlickFormBase::form in Slick Carousel 8.2

Same name and namespace in other branches
  1. 8 slick_ui/src/Form/SlickFormBase.php \Drupal\slick_ui\Form\SlickFormBase::form()

Gets the actual form array to be built.

Overrides EntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

1 call to SlickFormBase::form()
SlickForm::form in slick_ui/src/Form/SlickForm.php
Gets the actual form array to be built.
1 method overrides SlickFormBase::form()
SlickForm::form in slick_ui/src/Form/SlickForm.php
Gets the actual form array to be built.

File

slick_ui/src/Form/SlickFormBase.php, line 83

Class

SlickFormBase
Provides base form for a slick instance configuration form.

Namespace

Drupal\slick_ui\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $admin_css = $this->manager
    ->configLoad('admin_css', 'blazy.settings');
  $form['#attributes']['class'][] = 'form--blazy form--slick form--optionset has-tooltip';

  // Change page title for the duplicate operation.
  if ($this->operation == 'duplicate') {
    $form['#title'] = $this
      ->t('<em>Duplicate %name optionset</em>: @label', [
      '%name' => static::$niceName,
      '@label' => $this->entity
        ->label(),
    ]);
    $this->entity = $this->entity
      ->createDuplicate();
  }

  // Change page title for the edit operation.
  if ($this->operation == 'edit') {
    $form['#title'] = $this
      ->t('<em>Edit %name optionset</em>: @label', [
      '%name' => static::$niceName,
      '@label' => $this->entity
        ->label(),
    ]);
  }

  // Attach Slick admin library.
  if ($admin_css) {
    $form['#attached']['library'][] = 'slick_ui/slick.admin.vtabs';
  }
  return parent::form($form, $form_state);
}