public static ConfigEntityBase::sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
Helper callback for uasort() to sort configuration entities by weight and label.
File
- core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php, line 251
Class
- ConfigEntityBase
- Defines a base configuration entity class.
Namespace
Drupal\Core\Config\Entity
Code
1 2 3 4 5 6 7 8 9 10 | public static function sort(ConfigEntityInterface $a , ConfigEntityInterface $b ) { $a_weight = isset( $a ->weight) ? $a ->weight : 0; $b_weight = isset( $b ->weight) ? $b ->weight : 0; if ( $a_weight == $b_weight ) { $a_label = $a ->label(); $b_label = $b ->label(); return strnatcasecmp ( $a_label , $b_label ); } return ( $a_weight < $b_weight ) ? -1 : 1; } |
Please login to continue.