public function CodemirrorModePluginManager::getActiveModes in The CodeMirror Editor 8
Returns active language modes.
Return value
string[] An array of active language modes.
Overrides CodemirrorModeManagerInterface::getActiveModes
File
- src/
CodemirrorModePluginManager.php, line 82
Class
- CodemirrorModePluginManager
- Defines a plugin manager to deal with CodeMirror modes.
Namespace
Drupal\codemirror_editorCode
public function getActiveModes() {
$enabled_modes = $this->configFactory
->get('codemirror_editor.settings')
->get('language_modes');
$modes = [];
foreach ($this
->getDefinitions() as $mode => $definition) {
if (in_array($mode, $enabled_modes) || count($definition['usage']) > 0) {
$modes[] = $mode;
foreach ($definition['dependencies'] as $dependency) {
$modes[] = $dependency;
}
}
}
return array_unique($modes);
}