You are here

public static function FooTableBreakpoint::sort in FooTable 8.2

Same name and namespace in other branches
  1. 8 src/Entity/FooTableBreakpoint.php \Drupal\footable\Entity\FooTableBreakpoint::sort()

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

Overrides ConfigEntityBase::sort

File

src/Entity/FooTableBreakpoint.php, line 101

Class

FooTableBreakpoint
Defines the FooTable Breakpoint Config entity.

Namespace

Drupal\footable\Entity

Code

public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
  $breakpointA = $a
    ->getBreakpoint();
  $breakpointB = $b
    ->getBreakpoint();
  if ($breakpointA === $breakpointB) {
    return strnatcasecmp($a
      ->label(), $b
      ->label());
  }
  return $breakpointA < $breakpointB ? -1 : 1;
}