protected function MessagePurgePluginManager::sortDefinitions in Message 8
Sort plugin definitions based on plugin settings.
1 call to MessagePurgePluginManager::sortDefinitions()
- MessagePurgePluginManager::purgeSettingsForm in src/
MessagePurgePluginManager.php - Construct the purge method form.
File
- src/
MessagePurgePluginManager.php, line 150
Class
- MessagePurgePluginManager
- Plugin type manager for MessagePurge plugins.
Namespace
Drupal\messageCode
protected function sortDefinitions(array &$definitions, array $settings) {
uasort($definitions, function ($a, $b) use ($settings) {
$weight_a = isset($settings[$a['id']]) ? $settings[$a['id']]['weight'] : 0;
$weight_b = isset($settings[$b['id']]) ? $settings[$b['id']]['weight'] : 0;
if ($weight_a == $weight_b) {
return 0;
}
return $weight_a < $weight_b ? -1 : 1;
});
}