private function CodeSnippet::getLanguages in CKEditor CodeSnippet 8
Return an array of languages.
This should be used when presenting language options to the user in a form element.
Unlike getDefaultLanguages(), this provides human friendly names for languages (ex. C++ instead of cpp).
These languages are provided as options by the module because these are the languages that come with HighlightJS in the CodeSnippet CKEditor plugin.
To add more languages, users can easily implement hook_form_alter() and add to the options array.
Return value
array Set of programming languages.
3 calls to CodeSnippet::getLanguages()
- CodeSnippet::getConfig in src/
Plugin/ CKEditorPlugin/ CodeSnippet.php - Returns the additions to CKEDITOR.config for a specific CKEditor instance.
- CodeSnippet::getDefaultLanguages in src/
Plugin/ CKEditorPlugin/ CodeSnippet.php - Return an array of languages.
- CodeSnippet::settingsForm in src/
Plugin/ CKEditorPlugin/ CodeSnippet.php - Returns a settings form to configure this CKEditor plugin.
File
- src/
Plugin/ CKEditorPlugin/ CodeSnippet.php, line 158
Class
- CodeSnippet
- Defines the "codesnippet" plugin.
Namespace
Drupal\codesnippet\Plugin\CKEditorPluginCode
private function getLanguages() {
return [
'apache' => 'Apache',
'bash' => 'Bash',
'coffeescript' => 'CoffeeScript',
'cpp' => 'C++',
'cs' => 'C#',
'css' => 'CSS',
'diff' => 'Diff',
'html' => 'HTML',
'http' => 'HTTP',
'ini' => 'INI',
'java' => 'Java',
'javascript' => 'JavaScript',
'json' => 'JSON',
'makefile' => 'Makefile',
'markdown' => 'Markdown',
'nginx' => 'Nginx',
'objectivec' => 'Objective-C',
'perl' => 'Perl',
'php' => 'PHP',
'python' => 'Python',
'ruby' => 'Ruby',
'sql' => 'SQL',
'vbscript' => 'VBScript',
'xhtml' => 'XHTML',
'xml' => 'XML',
];
}