You are here

public function Gutenberg::settingsForm in Gutenberg 8

File

src/Plugin/Editor/Gutenberg.php, line 114

Class

Gutenberg
Defines a Gutenberg-based text editor for Drupal.

Namespace

Drupal\gutenberg\Plugin\Editor

Code

public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {

  // Gutenberg plugin settings, if any.
  $form['plugin_settings'] = [
    '#type' => 'vertical_tabs',
    '#title' => $this
      ->t('Gutenberg plugin settings'),
    '#attributes' => [
      'id' => 'gutenberg-plugin-settings',
    ],
  ];
  $this->gutenbergPluginManager
    ->injectPluginSettingsForm($form, $form_state, $editor);
  if (count(Element::children($form['plugins'])) === 0) {
    unset($form['plugins']);
    unset($form['plugin_settings']);
  }
  return $form;
}