SearchPage::sort

public static SearchPage::sort(ConfigEntityInterface $a, ConfigEntityInterface $b)

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

Overrides ConfigEntityBase::sort

File

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

Class

SearchPage
Defines a configured search page.

Namespace

Drupal\search\Entity

Code

public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
  /** @var $a \Drupal\search\SearchPageInterface */
  /** @var $b \Drupal\search\SearchPageInterface */
  $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);
}
doc_Drupal
2016-10-29 09:40:22
Comments
Leave a Comment

Please login to continue.