protected function FacetsBlock::sortFacetsByWeight in Facets Block 8
Sorts array of objects by object weight property.
Parameters
\Drupal\facets\FacetInterface $a: A facet.
\Drupal\facets\FacetInterface $b: A facet.
Return value
int Sort value.
File
- src/
Plugin/ Block/ FacetsBlock.php, line 177
Class
- FacetsBlock
- Provides a 'Facets Block' block.
Namespace
Drupal\facets_block\Plugin\BlockCode
protected function sortFacetsByWeight(FacetInterface $a, FacetInterface $b) {
$a_weight = $a
->getWeight();
$b_weight = $b
->getWeight();
if ($a_weight == $b_weight) {
return 0;
}
return $a_weight < $b_weight ? -1 : 1;
}