class ZoneSortingService (View source)

Methods

__construct(UserContextService|null $userContextService = null)

No description

array
getZoneSortOrder(array $allowedValues, string $sessionKey = SessionKeys::LIST_ZONE_SORT_BY, string $defaultSortBy = 'name', mixed $submittedSortBy = null, mixed $submittedDirection = null)

Get zone sort order from session/submitted values. Callers pass distinct $sessionKey values (see {SessionKeys}) to keep buckets isolated.

array
applySortingToZones(array $zones, string $sortBy, string $sortType)

Apply client-side sorting to reverse zones when sorting by name

string
getReverseZoneTypeFilter(mixed $submittedType = null)

Get reverse zone type filter from a submitted value, falling back to session.

Details

__construct(UserContextService|null $userContextService = null)

No description

Parameters

UserContextService|null $userContextService

array getZoneSortOrder(array $allowedValues, string $sessionKey = SessionKeys::LIST_ZONE_SORT_BY, string $defaultSortBy = 'name', mixed $submittedSortBy = null, mixed $submittedDirection = null)

Get zone sort order from session/submitted values. Callers pass distinct $sessionKey values (see {SessionKeys}) to keep buckets isolated.

Parameters

array $allowedValues

Allowed sort values

string $sessionKey

Session bucket (direction stored under $sessionKey . '_direction')

string $defaultSortBy

Fallback sort column when nothing valid is supplied

mixed $submittedSortBy

Sort column as submitted (POST first, then GET); anything but a string is ignored

mixed $submittedDirection

Sort direction as submitted; anything but a string is ignored

Return Value

array

[sortBy, sortDirection]

array applySortingToZones(array $zones, string $sortBy, string $sortType)

Apply client-side sorting to reverse zones when sorting by name

Parameters

array $zones

Array of zones to sort

string $sortBy

Sort column

string $sortType

Sorting type (natural, etc.)

Return Value

array

Sorted zones

string getReverseZoneTypeFilter(mixed $submittedType = null)

Get reverse zone type filter from a submitted value, falling back to session.

Parameters

mixed $submittedType

Filter value as submitted; anything but a string is ignored

Return Value

string