You are here

public function FacetsPrettyPathsUrlProcessor::sortByWeightAndName in Facets Pretty Paths 8

Sorts an array with weight and name values.

It sorts first by weight, then by the alias of the facet item value.

Parameters

array $pretty_paths: The values to sort.

Return value

array The sorted values.

1 call to FacetsPrettyPathsUrlProcessor::sortByWeightAndName()
FacetsPrettyPathsUrlProcessor::buildUrls in src/Plugin/facets/url_processor/FacetsPrettyPathsUrlProcessor.php
Adds urls to the results.

File

src/Plugin/facets/url_processor/FacetsPrettyPathsUrlProcessor.php, line 198

Class

FacetsPrettyPathsUrlProcessor
Pretty paths URL processor.

Namespace

Drupal\facets_pretty_paths\Plugin\facets\url_processor

Code

public function sortByWeightAndName(array $pretty_paths) {
  array_multisort(array_column($pretty_paths, 'weight'), SORT_ASC, array_column($pretty_paths, 'name'), SORT_ASC, array_column($pretty_paths, 'pretty_path_alias'), SORT_ASC, $pretty_paths);
  return $pretty_paths;
}