You are here

public function TextareaWithSummaryAndCounterWidget::addSummaryMaxlengthSummary in Textfield Counter 8

Adds summary of the maximum number of allowed of characters in the summary.

Parameters

array $summary: The array of summaries to which the summary should be added.

1 call to TextareaWithSummaryAndCounterWidget::addSummaryMaxlengthSummary()
TextareaWithSummaryAndCounterWidget::settingsSummary in src/Plugin/Field/FieldWidget/TextareaWithSummaryAndCounterWidget.php
Returns a short summary for the current widget settings.

File

src/Plugin/Field/FieldWidget/TextareaWithSummaryAndCounterWidget.php, line 200

Class

TextareaWithSummaryAndCounterWidget
Plugin implementation of the 'text_textarea_with_summary_and_counter' widget.

Namespace

Drupal\textfield_counter\Plugin\Field\FieldWidget

Code

public function addSummaryMaxlengthSummary(array &$summary) {
  if ($this
    ->getSetting('show_summary')) {
    $maxlength = $this
      ->getSetting('summary_maxlength');
    $text = $this
      ->t('Maximum number of characters in the summary: %count', [
      '%count' => $maxlength ? $maxlength : $this
        ->t('Disabled'),
    ]);
    $summary['summary_maxlength'] = $text;
  }
}