public function N1ED::settingsForm in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2
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/ N1ED.php, line 227
Class
- N1ED
- Defines plugin.
Namespace
Drupal\n1ed\Plugin\CKEditorPluginCode
public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
$config = $this
->getConfig($editor);
$form['info'] = [
'#type' => 'html_tag',
'#tag' => 'div',
'#attributes' => [
'data-n1ed-eco-plugin' => 'N1EDEco',
'style' => 'display: inline-block;margin-top: 13px;margin-left: 10px;',
],
'#value' => '<a href="#n1ed-conf">' . t('Configure add-on') . '</a>',
];
$form['#attached']['library'][] = 'n1ed/n1ed';
$form['#attached']['drupalSettings']['n1edApiKey'] = \Drupal::config('n1ed.settings')
->get('apikey') ?: 'N1D8DFLT';
$form['#attached']['drupalSettings']['useFlmngrOnFileFields'] = \Drupal::config('n1ed.settings')
->get('useFlmngrOnFileFields') ? 1 : 0;
$form['#attached']['drupalSettings']['selfHostedN1ED'] = \Drupal::config('n1ed.settings')
->get('selfHosted') ? 1 : 0;
$form['#attached']['drupalSettings']['n1edToken'] = \Drupal::config('n1ed.settings')
->get('token') ?: NULL;
$this
->addBooleanToForm($form, $config, "enableN1EDEcoSystem", TRUE);
return $form;
}