You are here

public function ColorFieldDefaultWidget::settingsSummary in Color Field 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 WidgetBase::settingsSummary

File

src/Plugin/Field/FieldWidget/ColorFieldDefaultWidget.php, line 60
Contains Drupal\color_field\Plugin\Field\FieldWidget\ColorFieldDefaultWidget.

Class

ColorFieldDefaultWidget
Plugin implementation of the 'color_field_default' widget.

Namespace

Drupal\color_field\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = array();
  $placeholder_color = $this
    ->getSetting('placeholder_color');
  $placeholder_opacity = $this
    ->getSetting('placeholder_opacity');
  if (!empty($placeholder_color)) {
    $summary[] = t('Color placeholder: @placeholder_color', array(
      '@placeholder_color' => $placeholder_color,
    ));
  }
  if (!empty($placeholder_opacity)) {
    $summary[] = t('Opacity placeholder: @placeholder_opacity', array(
      '@placeholder_opacity' => $placeholder_opacity,
    ));
  }
  if (empty($summary)) {
    $summary[] = t('No placeholder');
  }
  return $summary;
}