You are here

protected function FlexsliderFormatterTrait::buildSettingsForm in Flex Slider 8.2

Builds the FlexSlider settings form.

Return value

array The render array for Optionset settings.

3 calls to FlexsliderFormatterTrait::buildSettingsForm()
FlexsliderEntityFormatter::settingsForm in flexslider_fields/src/Plugin/Field/FieldFormatter/FlexsliderEntityFormatter.php
Returns a form to configure settings for the formatter.
FlexsliderFormatter::settingsForm in flexslider_fields/src/Plugin/Field/FieldFormatter/FlexsliderFormatter.php
Returns a form to configure settings for the formatter.
FlexsliderResponsiveFormatter::settingsForm in flexslider_fields/src/Plugin/Field/FieldFormatter/FlexsliderResponsiveFormatter.php
Returns a form to configure settings for the formatter.

File

flexslider_fields/src/Plugin/Field/FieldFormatter/FlexsliderFormatterTrait.php, line 53

Class

FlexsliderFormatterTrait
A common trait for all FlexSlider formatters (image + entity).

Namespace

Drupal\flexslider_fields\Plugin\Field\FieldFormatter

Code

protected function buildSettingsForm() {

  // Get list of option sets as an associative array.
  $optionsets = flexslider_optionset_list();
  $element['optionset'] = [
    '#title' => $this
      ->t('Option Set'),
    '#type' => 'select',
    '#default_value' => $this
      ->getSetting('optionset'),
    '#options' => $optionsets,
  ];
  $element['links'] = [
    '#theme' => 'links',
    '#links' => [
      [
        'title' => $this
          ->t('Create new option set'),
        'url' => Url::fromRoute('entity.flexslider.add_form', [], [
          'query' => \Drupal::destination()
            ->getAsArray(),
        ]),
      ],
      [
        'title' => $this
          ->t('Manage option sets'),
        'url' => Url::fromRoute('entity.flexslider.collection', [], [
          'query' => \Drupal::destination()
            ->getAsArray(),
        ]),
      ],
    ],
    '#access' => \Drupal::currentUser()
      ->hasPermission('administer flexslider'),
  ];
  return $element;
}