public function getEnabledDefinitions(EditorInterface
$editor): array
{ $definitions =
$this->
getDefinitions();
ksort($definitions);
$definitions_with_plugins_condition =
[];
foreach ($definitions as $plugin_id =>
$definition) { // Remove definition when plugin has conditions and they are not met.
if ($definition->
hasConditions()) { $plugin =
$this->
getPlugin($plugin_id,
$editor);
if ($this->
isPluginDisabled($plugin,
$editor)) { unset($definitions[$plugin_id]);
} else { // The `plugins` condition can only be evaluated at the end of
// gathering enabled definitions. ::isPluginDisabled() did not yet
// evaluate that condition.
if (array_key_exists('plugins',
$definition->
getConditions())) { $definitions_with_plugins_condition[$plugin_id] =
$definition;
} } }