You are here

public function AceFilter::settingsForm in Ace Code Editor 8

Setting form for filters.

Overrides FilterBase::settingsForm

File

src/Plugin/Filter/AceFilter.php, line 37

Class

AceFilter
Filters implementation for Ace Editor.

Namespace

Drupal\ace_editor\Plugin\Filter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $settings = $this->settings;
  $config = \Drupal::config('ace_editor.settings');
  return [
    'theme' => [
      '#type' => 'select',
      '#title' => t('Theme'),
      '#options' => $config
        ->get('theme_list'),
      '#attributes' => [
        'style' => 'width: 150px;',
      ],
      '#default_value' => $settings['theme'],
    ],
    'syntax' => [
      '#type' => 'select',
      '#title' => t('Syntax'),
      '#description' => t('The syntax that will be highlighted.'),
      '#options' => $config
        ->get('syntax_list'),
      '#attributes' => [
        'style' => 'width: 150px;',
      ],
      '#default_value' => $settings['syntax'],
    ],
    'height' => [
      '#type' => 'textfield',
      '#title' => t('Height'),
      '#description' => t('The height of the editor in either pixels or percents.'),
      '#attributes' => [
        'style' => 'width: 100px;',
      ],
      '#default_value' => $settings['height'],
    ],
    'width' => [
      '#type' => 'textfield',
      '#title' => t('Width'),
      '#description' => t('The width of the editor in either pixels or percents.'),
      '#attributes' => [
        'style' => 'width: 100px;',
      ],
      '#default_value' => $settings['width'],
    ],
    'font_size' => [
      '#type' => 'textfield',
      '#title' => t('Font size'),
      '#description' => t('The the font size of the editor.'),
      '#attributes' => [
        'style' => 'width: 100px;',
      ],
      '#default_value' => $settings['font_size'],
    ],
    'line_numbers' => [
      '#type' => 'checkbox',
      '#title' => t('Show line numbers'),
      '#default_value' => $settings['line_numbers'],
    ],
    'print_margins' => [
      '#type' => 'checkbox',
      '#title' => t('Show print margin (80 chars)'),
      '#default_value' => $settings['print_margins'],
    ],
    'show_invisibles' => [
      '#type' => 'checkbox',
      '#title' => t('Show invisible characters (whitespaces, EOL...)'),
      '#default_value' => $settings['show_invisibles'],
    ],
    'use_wrap_mode' => [
      '#type' => 'checkbox',
      '#title' => t('Toggle word wrapping'),
      '#default_value' => $settings['use_wrap_mode'],
    ],
  ];
}