function CodeBlock::buildConfigurationForm
Same name in other branches
- 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/CodeBlock.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\CodeBlock::buildConfigurationForm()
File
-
core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ CodeBlock.php, line 26
Class
- CodeBlock
- CKEditor 5 Code Block plugin configuration.
Namespace
Drupal\ckeditor5\Plugin\CKEditor5PluginCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['languages'] = [
'#title' => $this->t('Programming languages'),
'#type' => 'textarea',
'#description' => $this->t('A list of programming languages that will be provided in the "Code Block" dropdown. Enter one value per line, in the format key|label. Example: php|PHP.'),
];
if (!empty($this->configuration['languages'])) {
$as_selectors = '';
foreach ($this->configuration['languages'] as $language) {
$as_selectors .= sprintf("%s|%s\n", $language['language'], $language['label']);
}
$form['languages']['#default_value'] = $as_selectors;
}
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.