You are here

public function SimpleStockLevelWidget::settingsSummary in Commerce Stock 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

modules/field/src/Plugin/Field/FieldWidget/SimpleStockLevelWidget.php, line 100

Class

SimpleStockLevelWidget
Plugin implementation of the 'commerce_stock_level' widget.

Namespace

Drupal\commerce_stock_field\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('Deprecated: This widget is deprecated and will be removed soon. Please choose another widget.');
  $summary[] = $this
    ->t('Entry system: @entry_system', [
    '@entry_system' => $this
      ->getSetting('entry_system'),
  ]);
  if ($this
    ->getSetting('entry_system') != 'transactions') {
    $summary[] = $this
      ->t('Transaction note: @transaction_note', [
      '@transaction_note' => $this
        ->getSetting('transaction_note') ? 'Yes' : 'No',
    ]);
    $summary[] = $this
      ->t('context fallback: @context_fallback', [
      '@context_fallback' => $this
        ->getSetting('context_fallback') ? 'Yes' : 'No',
    ]);
  }
  return $summary;
}