You are here

public function PriceTableDefaultFormatter::settingsSummary in Commerce Price Table 8

Returns a short summary for the current formatter settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.

Return value

string[] A short summary of the formatter settings.

Overrides PriceDefaultFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/PriceTableDefaultFormatter.php, line 102

Class

PriceTableDefaultFormatter
Plugin implementation of the 'commerce_price_table' formatter.

Namespace

Drupal\commerce_price_table\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $quantity_label = $this
    ->getSetting('quantity_label');
  $price_label = $this
    ->getSetting('price_label');
  $summary = [
    $this
      ->t('Quantity label: @label', [
      '@label' => !empty($quantity_label) ? $quantity_label : $this
        ->t('Quantity'),
    ]),
    $this
      ->t('Price label: @label', [
      '@label' => !empty($price_label) ? $price_label : $this
        ->t('Price'),
    ]),
    $this
      ->t('Orientation: @label', [
      '@label' => $this
        ->getOrientationLabel($this
        ->getSetting('table_orientation')),
    ]),
  ] + parent::settingsSummary();
  return $summary;
}