You are here

public function QuantityWidget::settingsSummary in Commerce Core 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 NumberWidget::settingsSummary

File

modules/order/src/Plugin/Field/FieldWidget/QuantityWidget.php, line 88

Class

QuantityWidget
Plugin implementation of the 'commerce_quantity' widget.

Namespace

Drupal\commerce_order\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  if ($this
    ->getSetting('step') == 1) {
    $summary[] = $this
      ->t('Decimal quantities not allowed');
  }
  else {
    $summary[] = $this
      ->t('Decimal quantities allowed');
    $summary[] = $this
      ->t('Step: @step', [
      '@step' => $this
        ->getSetting('step'),
    ]);
  }
  return $summary;
}