public function ScaytCKEditorButton::settingsForm in CKEditor SpellCheckAsYouType (SCAYT) 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/ ScaytCKEditorButton.php, line 202
Class
- ScaytCKEditorButton
- Defines the "scayt" plugin.
Namespace
Drupal\ckeditor_scayt\Plugin\CKEditorPluginCode
public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
// Defaults.
$config = $this
->getConfig($editor);
$form['scayt_autoStartup'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Auto startup'),
'#description' => $this
->t('Enables Grammar As You Type (GRAYT) on SCAYT startup. When enabled, this option turns on GRAYT automatically after SCAYT started.'),
'#default_value' => $config['scayt_autoStartup'],
];
// Populate language options.
$languages = $this->configModule
->get('languages');
$options = [];
foreach ($languages as $language) {
$parts = explode('|', $language);
$options[$parts[0]] = $parts[1];
}
$form['scayt_sLang'] = [
'#type' => 'select',
'#title' => $this
->t('Language'),
'#options' => $options,
'#description' => $this
->t('Sets the default spell checking language for SCAYT.'),
'#default_value' => $config['scayt_sLang'],
];
$help_text = <<<'EOT'
<p>Disables storing of SCAYT options between sessions. Option storing will be turned off after a page refresh.
The following settings can be used:</p>
<ul>
<li><code>options</code> – Disables storing of all SCAYT Ignore options.</li>
<li><code>ignore-all-caps-words</code> – Disables storing of the "Ignore All-Caps Words" option.</li>
<li><code>ignore-domain-names</code> – Disables storing of the "Ignore Domain Names" option.</li>
<li><code>ignore-words-with-mixed-cases</code> – Disables storing of the "Ignore Words with Mixed Case" option.</li>
<li><code>ignore-words-with-numbers</code> – Disables storing of the "Ignore Words with Numbers" option.</li>
<li><code>lang</code> – Disables storing of the SCAYT spell check language.</li>
<li><code>all</code> – Disables storing of all SCAYT options.</li>
</ul>
<p>You may enter multiple values with comma separated.</p>
EOT;
$form['scayt_disableOptionsStorage'] = [
'#type' => 'textfield',
'#title' => $this
->t('Disable options storage'),
'#description' => $help_text,
'#default_value' => implode(',', $config['scayt_disableOptionsStorage']),
];
return $form;
}