public static function DateFormat::sort

public static DateFormat::sort(ConfigEntityInterface $a, ConfigEntityInterface $b)

Helper callback for uasort() to sort configuration entities by weight and label.

Overrides ConfigEntityBase::sort

File

core/lib/Drupal/Core/Datetime/Entity/DateFormat.php, line 87

Class

DateFormat
Defines the Date Format configuration entity class.

Namespace

Drupal\Core\Datetime\Entity

Code

public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
  if ($a->isLocked() == $b->isLocked()) {
    $a_label = $a->label();
    $b_label = $b->label();
    return strnatcasecmp($a_label, $b_label);
  }
  return $a->isLocked() ? 1 : -1;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Datetime!Entity!DateFormat.php/function/DateFormat::sort/8.1.x