You are here

public function FlexsliderFormSettings::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 ConfigFormBase::buildForm

File

src/Form/FlexsliderFormSettings.php, line 95

Class

FlexsliderFormSettings
Class FlexsliderFormSettings.

Namespace

Drupal\flexslider\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = [];
  $form['library'] = [
    '#type' => 'details',
    '#title' => 'Library',
    '#open' => TRUE,
  ];

  // Debug mode toggle.
  $form['library']['flexslider_debug'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable debug mode'),
    '#description' => $this
      ->t('Load the human-readable version of the FlexSlider library.'),
    '#default_value' => $this
      ->config('flexslider.settings')
      ->get('flexslider_debug'),
    '#access' => $this->currentUser
      ->hasPermission('administer flexslider'),
  ];

  // Style toggles.
  $form['styles'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Syles'),
    '#open' => TRUE,
  ];
  $form['styles']['flexslider_css'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('flexslider.css'),
    '#description' => $this
      ->t('Load the FlexSlider base css.'),
    '#default_value' => $this
      ->config('flexslider.settings')
      ->get('flexslider_css'),
  ];
  $form['styles']['integration_css'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('flexslider_img.css'),
    '#description' => $this
      ->t('Load the module css fixes.'),
    '#default_value' => $this
      ->config('flexslider.settings')
      ->get('flexslider_module_css'),
  ];
  return parent::buildForm($form, $form_state);
}