public function ContributorPropertiesService::sortByWeightProperty in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_entity/src/ContributorPropertiesService.php \Drupal\bibcite_entity\ContributorPropertiesService::sortByWeightProperty()
Sort callback for config entities with weight parameter.
Parameters
\Drupal\Core\Config\Entity\ConfigEntityInterface $entity_first: First entity to compare.
\Drupal\Core\Config\Entity\ConfigEntityInterface $entity_second: Second entity to compare.
Return value
int Sort result.
Overrides ContributorPropertiesServiceInterface::sortByWeightProperty
File
- modules/
bibcite_entity/ src/ ContributorPropertiesService.php, line 129
Class
- ContributorPropertiesService
- Class ContributorPropertiesService.
Namespace
Drupal\bibcite_entityCode
public function sortByWeightProperty(ConfigEntityInterface $entity_first, ConfigEntityInterface $entity_second) {
$weight_first = $entity_first
->get('weight');
$weight_second = $entity_second
->get('weight');
if ($weight_first == $weight_second) {
return 0;
}
return $weight_first < $weight_second ? -1 : 1;
}