private function addOptionsData(array $items)
{
if ($this->getAttributeModel()->getFacetSortOrder() == BucketInterface::SORT_ORDER_MANUAL) {
$options = $this->getAttributeModel()->getFrontend()->getSelectOptions();
$optionPosition = 0;
if (!empty($options)) {
foreach ($options as $option) {
$optionLabel = (string) $option['label'];
$optionPosition++;
if ($optionLabel && isset($items[$optionLabel])) {
$items[$optionLabel]['adminSortIndex'] = $optionPosition;
$items[$optionLabel]['value'] = $option['value'];
}
}
}
usort($items, function ($item1, $item2) {
return $item1['adminSortIndex'] <= $item2['adminSortIndex'] ? -1 : 1;
});
}
return $items;
}