function SearchPage::sort
Same name in other branches
- 9 core/modules/search/src/Entity/SearchPage.php \Drupal\search\Entity\SearchPage::sort()
- 8.9.x core/modules/search/src/Entity/SearchPage.php \Drupal\search\Entity\SearchPage::sort()
- 11.x core/modules/search/src/Entity/SearchPage.php \Drupal\search\Entity\SearchPage::sort()
Helper callback for uasort() to sort search page entities by status, 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\EntityCode
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 $b_status <=> $a_status;
}
return parent::sort($a, $b);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.