HierarchicalFacetHelperInterface
in
Hierarchical facet helper interface
Tags
Table of Contents
- buildFacetArray() : array<string|int, mixed>
- Helper method for building hierarchical facets: Convert facet list to a hierarchical array
- flattenFacetHierarchy() : array<string|int, mixed>
- Flatten a hierarchical facet list to a simple array
- formatDisplayText() : TranslatableString
- Format a facet display text for displaying
- getFilterStringParts() : array<string|int, mixed>
- Format a filter string in parts suitable for displaying or translation
- isDeepestFacetLevel() : bool
- Check if the given value is the deepest level in the facet list.
- sortFacetList() : void
- Helper method for building hierarchical facets: Sort a facet list according to the given sort order
Methods
buildFacetArray()
Helper method for building hierarchical facets: Convert facet list to a hierarchical array
public
buildFacetArray(string $facet, array<string|int, mixed> $facetList[, UrlHelper $urlHelper = false ][, bool $escape = true ]) : array<string|int, mixed>
Parameters
- $facet : string
-
Facet name
- $facetList : array<string|int, mixed>
-
Facet list
- $urlHelper : UrlHelper = false
-
Query URL helper for building facet URLs
- $escape : bool = true
-
Whether to escape URLs
Tags
Return values
array<string|int, mixed> —Facet hierarchy
flattenFacetHierarchy()
Flatten a hierarchical facet list to a simple array
public
flattenFacetHierarchy(array<string|int, mixed> $facetList) : array<string|int, mixed>
Parameters
- $facetList : array<string|int, mixed>
-
Facet list
Return values
array<string|int, mixed> —Simple array of facets
formatDisplayText()
Format a facet display text for displaying
public
formatDisplayText(string $displayText[, bool $allLevels = false ][, string $separator = '/' ][, string|false $domain = false ]) : TranslatableString
Parameters
- $displayText : string
-
Display text
- $allLevels : bool = false
-
Whether to display all levels or only the current one
- $separator : string = '/'
-
Separator string displayed between levels
- $domain : string|false = false
-
Translation domain for default translations of a multilevel string or false to omit translation
Return values
TranslatableString —Formatted text
getFilterStringParts()
Format a filter string in parts suitable for displaying or translation
public
getFilterStringParts(string $filter) : array<string|int, mixed>
Parameters
- $filter : string
-
Filter value
Return values
array<string|int, mixed> —isDeepestFacetLevel()
Check if the given value is the deepest level in the facet list.
public
isDeepestFacetLevel(array<string|int, mixed> $facetList, string $value) : bool
Takes into account lists with multiple top levels.
Parameters
- $facetList : array<string|int, mixed>
-
Facet list
- $value : string
-
Facet value
Return values
bool —sortFacetList()
Helper method for building hierarchical facets: Sort a facet list according to the given sort order
public
sortFacetList(array<string|int, mixed> &$facetList[, bool|string $order = null ]) : void
Parameters
- $facetList : array<string|int, mixed>
-
Facet list returned from Solr
- $order : bool|string = null
-
Sort order:
- true|top sort top level alphabetically and the rest by count
- false|all sort all levels alphabetically
- count sort all levels by count