You are here

public function RoyalSliderFormatter::settingsForm in RoyalSlider Integration 8

Returns a form to configure settings for the formatter.

Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form elements for the formatter settings.

Overrides FormatterBase::settingsForm

File

src/Plugin/Field/FieldFormatter/RoyalSliderFormatter.php, line 102
Contains \Drupal\royalslider\Plugin\Field\FieldFormatter\RoyalSliderFormatter.

Class

RoyalSliderFormatter
Plugin implementation of the 'royalslider' formatter.

Namespace

Drupal\royalslider\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $royalslider_optionsets = royalslider_optionset_options(FALSE);
  $element['royalslider_optionset'] = array(
    '#title' => t('OptionSet'),
    '#type' => 'select',
    '#default_value' => $this
      ->getSetting('royalslider_optionset'),
    '#empty_option' => t('None (defaults)'),
    '#options' => $royalslider_optionsets,
    '#description' => array(
      '#markup' => $this->linkGenerator
        ->generate($this
        ->t('Configure RoyalSlider OptionSets'), new Url('entity.royalslider_optionset.collection')),
      '#access' => $this->currentUser
        ->hasPermission('administer site configuration'),
    ),
  );
  return $element;
}