/** * {@inheritdoc} */ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) { /** @var \Drupal\Core\Entity\EntityDisplayModeInterface $a */ /** @var \Drupal\Core\Entity\EntityDisplayModeInterface $b */ // Sort by the type of entity the view mode is used for. $a_type = $a->getTargetType(); $b_type = $b->getTargetType(); $type_order = strnatcasecmp($a_type, $b_type); return $type_order != 0 ? $type_order : parent::sort($a, $b); }
/** * {@inheritdoc} */ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) { /** @var \Drupal\system\ActionConfigEntityInterface $a */ /** @var \Drupal\system\ActionConfigEntityInterface $b */ $a_type = $a->getType(); $b_type = $b->getType(); if ($a_type != $b_type) { return strnatcasecmp($a_type, $b_type); } return parent::sort($a, $b); }
/** * {@inheritdoc} */ 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); }
/** * Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::sort(). */ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) { \Drupal::state()->set('config_entity_sort', TRUE); return parent::sort($a, $b); }
/** * {@inheritdoc} */ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $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); }