You are here

public function CpfDigitsWidget::settingsSummary in CPF 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/CpfDigitsWidget.php \Drupal\cpf\Plugin\Field\FieldWidget\CpfDigitsWidget::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/CpfDigitsWidget.php, line 67

Class

CpfDigitsWidget
Plugin implementation of the 'cpf_digits' widget.

Namespace

Drupal\cpf\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('Textfield size: @size', [
    '@size' => $this
      ->getSetting('size'),
  ]);
  $placeholder = $this
    ->getSetting('placeholder');
  if (!empty($placeholder)) {
    $summary[] = $this
      ->t('Placeholder: @placeholder', [
      '@placeholder' => $placeholder,
    ]);
  }
  $generator = empty($this
    ->getSetting('generator')) ? $this
    ->t('no') : $this
    ->t('yes');
  $summary[] = $this
    ->t('Link to generate CPF numbers: @generator', [
    '@generator' => $generator,
  ]);
  return $summary;
}