You are here

public function TextFieldCounterWidgetTrait::addJsSubmitPreventSummary in Textfield Counter 8

Adds the summary of the js_prevent_submit setting.

Parameters

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

5 calls to TextFieldCounterWidgetTrait::addJsSubmitPreventSummary()
StringTextareaWithCounterWidget::settingsSummary in src/Plugin/Field/FieldWidget/StringTextareaWithCounterWidget.php
Returns a short summary for the current widget settings.
StringTextfieldWithCounterWidget::settingsSummary in src/Plugin/Field/FieldWidget/StringTextfieldWithCounterWidget.php
Returns a short summary for the current widget settings.
TextareaWithCounterWidget::settingsSummary in src/Plugin/Field/FieldWidget/TextareaWithCounterWidget.php
Returns a short summary for the current widget settings.
TextareaWithSummaryAndCounterWidget::settingsSummary in src/Plugin/Field/FieldWidget/TextareaWithSummaryAndCounterWidget.php
Returns a short summary for the current widget settings.
TextfieldWithCounterWidget::settingsSummary in src/Plugin/Field/FieldWidget/TextfieldWithCounterWidget.php
Returns a short summary for the current widget settings.

File

src/Plugin/Field/FieldWidget/TextFieldCounterWidgetTrait.php, line 248

Class

TextFieldCounterWidgetTrait
Textfield counter trait. Adds textfield counting functionality.

Namespace

Drupal\textfield_counter\Plugin\Field\FieldWidget

Code

public function addJsSubmitPreventSummary(array &$summary) {
  if ($this
    ->getSetting('maxlength') && !$this
    ->getSetting('use_field_maxlength')) {
    $summary['js_prevent_submit'] = $this
      ->t('Prevent form submission when user goes over character count: %prevent', [
      '%prevent' => $this
        ->getSetting('js_prevent_submit') ? $this
        ->t('Yes') : $this
        ->t('No'),
    ]);
  }
}