You are here

public static function SearchPage::sort in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/search/src/Entity/SearchPage.php \Drupal\search\Entity\SearchPage::sort()

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

Overrides ConfigEntityBase::sort

File

core/modules/search/src/Entity/SearchPage.php, line 213

Class

SearchPage
Defines a configured search page.

Namespace

Drupal\search\Entity

Code

public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {

  /** @var \Drupal\search\SearchPageInterface $a */

  /** @var \Drupal\search\SearchPageInterface $b */
  $a_status = (int) $a
    ->status();
  $b_status = (int) $b
    ->status();
  if ($a_status != $b_status) {
    return $a_status > $b_status ? -1 : 1;
  }
  return parent::sort($a, $b);
}