You are here

public static function WebformOptions::sort in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Entity/WebformOptions.php \Drupal\webform\Entity\WebformOptions::sort()

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

Overrides ConfigEntityBase::sort

File

src/Entity/WebformOptions.php, line 198

Class

WebformOptions
Defines the webform options entity.

Namespace

Drupal\webform\Entity

Code

public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
  $a_label = $a
    ->get('category') . $a
    ->label();
  $b_label = $b
    ->get('category') . $b
    ->label();
  return strnatcasecmp($a_label, $b_label);
}