public static function MetatagDefaults::sort in Metatag 8
Helper callback for uasort() to sort configuration entities by weight and label.
Overrides ConfigEntityBase::sort
File
- src/
Entity/ MetatagDefaults.php, line 132
Class
- MetatagDefaults
- Defines the Metatag defaults entity.
Namespace
Drupal\metatag\EntityCode
public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
// Put always Global in 1st place and front page later if available.
if ($a
->id() == 'global') {
return -1;
}
elseif ($b
->id() == 'global') {
return 1;
}
elseif ($a
->id() == 'front') {
return -1;
}
elseif ($b
->id() == 'front') {
return 1;
}
// Use the default sort function.
return parent::sort($a, $b);
}