You are here

public function ColorFieldWidgetDefault::settingsSummary in Color Field 8.2

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/ColorFieldWidgetDefault.php, line 54

Class

ColorFieldWidgetDefault
Plugin implementation of the color_widget default input widget.

Namespace

Drupal\color_field\Plugin\Field\FieldWidget

Code

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