You are here

private function CodeSnippet::getStyles in CKEditor CodeSnippet 8

Returns available stylesheets to use for code syntax highlighting.

2 calls to CodeSnippet::getStyles()
CodeSnippet::getDefaultStyle in src/Plugin/CKEditorPlugin/CodeSnippet.php
Return the default style if one is not set in active config.
CodeSnippet::settingsForm in src/Plugin/CKEditorPlugin/CodeSnippet.php
Returns a settings form to configure this CKEditor plugin.

File

src/Plugin/CKEditorPlugin/CodeSnippet.php, line 98

Class

CodeSnippet
Defines the "codesnippet" plugin.

Namespace

Drupal\codesnippet\Plugin\CKEditorPlugin

Code

private function getStyles() {
  $styles = preg_grep('/\\.css/', scandir(DRUPAL_ROOT . '/libraries/codesnippet/lib/highlight/styles'));
  $style_options = [];
  foreach ($styles as $stylesheet) {
    $name = str_replace('.css', '', $stylesheet);
    $style_options[$name] = $name;
  }
  return $style_options;
}