uasort() callback to sort filters by status, weight, module, and name.
\Drupal\filter\FilterFormatStorageController::preSave()
public function sortHelper($aID, $bID) {
$a = $this
->get($aID);
$b = $this
->get($bID);
if ($a->status != $b->status) {
return !empty($a->status) ? -1 : 1;
}
if ($a->weight != $b->weight) {
return $a->weight < $b->weight ? -1 : 1;
}
if ($a->module != $b->module) {
return strnatcasecmp($a->module, $b->module);
}
return strnatcasecmp($a
->getPluginId(), $b
->getPluginId());
}