You are here

public function BarcodeWidget::settingsSummary in Barcode 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/BarcodeWidget.php, line 60

Class

BarcodeWidget
Defines the 'barcode' field widget.

Namespace

Drupal\barcode\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $settings = $this
    ->getSettings();
  $types = $this
    ->getFieldSetting('types');
  drupal_set_message(var_export($types, TRUE));
  $summary[] = $this
    ->t('Default Barcode type: @type', [
    '@type' => $settings['default'] ? $types[$settings['default']] : array_pop($types),
  ]);
  if ($settings['custom_placeholder']) {
    $summary[] = $this
      ->t('Placeholder: @placeholder', [
      '@placeholder' => $settings['placeholder'],
    ]);
  }
  else {
    $summary[] = $this
      ->t('Placeholder: Barcode type\'s default');
  }
  return $summary;
}