You are here

public function JqueryMinicolorsWidget::settingsSummary in jQuery minicolors 8

Returns a short summary for the current widget settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.

Return value

array A short summary of the widget settings.

Overrides StringTextfieldWidget::settingsSummary

File

src/Plugin/Field/FieldWidget/JqueryMinicolorsWidget.php, line 189

Class

JqueryMinicolorsWidget
Plugin implementation of the 'jquery_minicolors_widget' widget.

Namespace

Drupal\jquery_minicolors\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = t('Textfield size: @size', array(
    '@size' => $this
      ->getSetting('size'),
  ));
  if (!empty($this
    ->getSetting('placeholder'))) {
    $summary[] = t('Placeholder: @placeholder', array(
      '@placeholder' => $this
        ->getSetting('placeholder'),
    ));
  }
  $summary[] = t('Control: @control', array(
    '@control' => $this
      ->getSetting('control'),
  ));
  $summary[] = t('Format: @format', array(
    '@format' => $this
      ->getSetting('format'),
  ));
  $summary[] = t('Opacity: @opacity', array(
    '@opacity' => $this
      ->getSetting('opacity') ? 'true' : 'false',
  ));
  if (!empty($this
    ->getSetting('swatches'))) {
    $summary[] = t('Swatches: @swatches', array(
      '@swatches' => $this
        ->getSetting('swatches'),
    ));
  }
  $summary[] = t('Position: @position', array(
    '@position' => $this
      ->getSetting('position'),
  ));
  $summary[] = t('Theme: @theme', array(
    '@theme' => $this
      ->getSetting('theme'),
  ));
  if (!empty($this
    ->getSetting('animation_speed'))) {
    $summary[] = t('Animation speed: @animation_speed', array(
      '@animation_speed' => $this
        ->getSetting('animation_speed'),
    ));
  }
  if (!empty($this
    ->getSetting('animation_easing'))) {
    $summary[] = t('Animation easing: @animation_easing', array(
      '@animation_easing' => $this
        ->getSetting('animation_easing'),
    ));
  }
  $summary[] = t('Change delay: @change_delay', array(
    '@change_delay' => $this
      ->getSetting('change_delay'),
  ));
  return $summary;
}