You are here

public function DateRecurModularSierraWidget::settingsSummary in Recurring Date Field Modular Widgets 8

Same name and namespace in other branches
  1. 3.x src/Plugin/Field/FieldWidget/DateRecurModularSierraWidget.php \Drupal\date_recur_modular\Plugin\Field\FieldWidget\DateRecurModularSierraWidget::settingsSummary()
  2. 2.x src/Plugin/Field/FieldWidget/DateRecurModularSierraWidget.php \Drupal\date_recur_modular\Plugin\Field\FieldWidget\DateRecurModularSierraWidget::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/DateRecurModularSierraWidget.php, line 177

Class

DateRecurModularSierraWidget
Date recur sierra widget.

Namespace

Drupal\date_recur_modular\Plugin\Field\FieldWidget

Code

public function settingsSummary() : array {
  $summary = parent::settingsSummary();
  $interpreter = $this
    ->getInterpreter();
  $summary[] = $interpreter ? $this
    ->t('Interpreter: @label', [
    '@label' => $interpreter
      ->label() ?? $this
      ->t('- Missing label -'),
  ]) : $this
    ->t('No interpreter');
  if ($this
    ->isOccurrencesModalEnabled()) {
    $dateFormatId = $this
      ->getSetting('date_format_type');
    $dateFormat = $this->dateFormatStorage
      ->load($dateFormatId);
    $summary[] = $dateFormat ? $this
      ->t('Occurrence date format: @label', [
      '@label' => $dateFormat
        ->label() ?? $dateFormat
        ->id(),
    ]) : $this
      ->t('Occurrence date format: missing date format');
  }
  $summary[] = $this
    ->isOccurrencesModalEnabled() ? $this
    ->t('Occurrences button is enabled') : $this
    ->t('Occurrences button is disabled');
  return $summary;
}