You are here

public function Linebreaks::settingsForm in Wysiwyg Linebreaks 8

Returns a settings form to configure this CKEditor plugin.

If the plugin's behavior depends on extensive options and/or external data, then the implementing module can choose to provide a separate, global configuration page rather than per-text-editor settings. In that case, this form should provide a link to the separate settings page.

Parameters

array $form: An empty form array to be populated with a configuration form, if any.

\Drupal\Core\Form\FormStateInterface $form_state: The state of the entire filter administration form.

\Drupal\editor\Entity\Editor $editor: A configured text editor object.

Return value

array A render array for the settings form.

Overrides CKEditorPluginConfigurableInterface::settingsForm

File

src/Plugin/CKEditorPlugin/Linebreaks.php, line 75

Class

Linebreaks
Defines the "linebreaks" plugin.

Namespace

Drupal\wysiwyg_linebreaks\Plugin\CKEditorPlugin

Code

public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
  $default = $this
    ->getConfig($editor);
  $form['method'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Conversion Method'),
    '#default_value' => $default['linebreaks_method'],
    '#options' => [
      'force' => $this
        ->t('Force linebreaks'),
      'convert' => $this
        ->t('Convert linebreaks'),
    ],
    '#description' => $this
      ->t('Set to Force linebreaks if you never want to see <code>&lt;p&gt;</code> and
        <code>&lt;br /&gt;</code> tags in your content when editing without a Wysiwyg editor. Set to Convert linebreaks
         if you have content without <code>&lt;p&gt;</code> and <code>&lt;br /&gt;</code> tags that needs to be
          converted so it is still formatted correctly in the Wysiwyg editor.'),
  ];
  return $form;
}