You are here

public function FractionDecimalWidget::settingsSummary in Fraction 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldWidget/FractionDecimalWidget.php \Drupal\fraction\Plugin\Field\FieldWidget\FractionDecimalWidget::settingsSummary()

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/FractionDecimalWidget.php, line 62

Class

FractionDecimalWidget
Plugin implementation of the 'fraction_decimal' widget.

Namespace

Drupal\fraction\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();

  // Summarize the precision setting.
  $precision = $this
    ->getSetting('precision');
  $auto_precision = !empty($this
    ->getSetting('auto_precision')) ? 'On' : 'Off';
  $summary[] = $this
    ->t('Precision: @precision, Auto-precision: @auto_precision', [
    '@precision' => $precision,
    '@auto_precision' => $auto_precision,
  ]);
  return $summary;
}