public function InstallablePluginBase::getSortedConfiguration in Markdown 8.2
Retrieves the configuration for the plugin, but sorted.
Return value
array The sorted configuration array.
Overrides InstallablePluginInterface::getSortedConfiguration
File
- src/
Plugin/ Markdown/ InstallablePluginBase.php, line 285
Class
- InstallablePluginBase
- Base class for installable plugins.
Namespace
Drupal\markdown\Plugin\MarkdownCode
public function getSortedConfiguration() {
$configuration = $this
->getConfiguration();
$weights = $this
->getConfigurationSortOrder() + array_fill_keys(array_keys($configuration), 0);
uksort($configuration, function ($a, $b) use ($weights) {
$a = isset($weights[$a]) ? (int) $weights[$a] : 0;
$b = isset($weights[$b]) ? (int) $weights[$b] : 0;
if ($a === $b) {
return 0;
}
return $a < $b ? -1 : 1;
});
return $configuration;
}