You are here

public function CodeMirrorEditorWidget::settingsSummary in The CodeMirror Editor 8

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/CodeMirrorEditorWidget.php, line 64

Class

CodeMirrorEditorWidget
Defines the 'codemirror_editor' field widget.

Namespace

Drupal\codemirror_editor\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $settings = $this
    ->getSettings();
  $summary[] = $this
    ->t('Number of rows: @rows', [
    '@rows' => $settings['rows'],
  ]);
  if ($settings['placeholder'] != '') {
    $summary[] = $this
      ->t('Placeholder: @placeholder', [
      '@placeholder' => $settings['placeholder'],
    ]);
  }
  $summary[] = $this
    ->t('Language mode: @mode', [
    '@mode' => $this
      ->getSetting('mode'),
  ]);
  $summary[] = $this
    ->t('Load toolbar: @toolbar', [
    '@toolbar' => $this
      ->formatBoolean('toolbar'),
  ]);
  if ($settings['toolbar']) {
    $summary[] = $this
      ->t('Toolbar buttons: @buttons', [
      '@buttons' => implode(', ', $settings['buttons']),
    ]);
  }
  $summary[] = $this
    ->t('Line wrapping: @lineWrapping', [
    '@lineWrapping' => $this
      ->formatBoolean('lineWrapping'),
  ]);
  $summary[] = $this
    ->t('Line numbers: @lineNumbers', [
    '@lineNumbers' => $this
      ->formatBoolean('lineNumbers'),
  ]);
  $summary[] = $this
    ->t('Fold gutter: @foldGutter', [
    '@foldGutter' => $this
      ->formatBoolean('foldGutter'),
  ]);
  $summary[] = $this
    ->t('Auto close tags: @autoCloseTags', [
    '@autoCloseTags' => $this
      ->formatBoolean('autoCloseTags'),
  ]);
  $summary[] = $this
    ->t('Style active line: @styleActiveLine', [
    '@styleActiveLine' => $this
      ->formatBoolean('styleActiveLine'),
  ]);
  return $summary;
}