public static function EntityDisplayModeBase::sort in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php \Drupal\Core\Entity\EntityDisplayModeBase::sort()
Helper callback for uasort() to sort configuration entities by weight and label.
Overrides ConfigEntityBase::sort
File
- core/
lib/ Drupal/ Core/ Entity/ EntityDisplayModeBase.php, line 59
Class
- EntityDisplayModeBase
- Base class for config entity types with settings for form and view modes.
Namespace
Drupal\Core\EntityCode
public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
/** @var \Drupal\Core\Entity\EntityDisplayModeInterface $a */
/** @var \Drupal\Core\Entity\EntityDisplayModeInterface $b */
// Sort by the type of entity the view mode is used for.
$a_type = $a
->getTargetType();
$b_type = $b
->getTargetType();
$type_order = strnatcasecmp($a_type, $b_type);
return $type_order != 0 ? $type_order : parent::sort($a, $b);
}