You are here

public static function WebformOptionsCustom::sort in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_options_custom/src/Entity/WebformOptionsCustom.php \Drupal\webform_options_custom\Entity\WebformOptionsCustom::sort()

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

Overrides ConfigEntityBase::sort

File

modules/webform_options_custom/src/Entity/WebformOptionsCustom.php, line 394

Class

WebformOptionsCustom
Defines the webform options custom entity.

Namespace

Drupal\webform_options_custom\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);
}