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) {
                    if (isset($option['label'])) {
                        // Manage labels that contains single quote.
                        $optionLabel = trim((string) htmlspecialchars($option['label'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', false));
                        $optionPosition++;

                        if ($optionLabel !== null && isset($items[$optionLabel])) {
                            $items[$optionLabel]['adminSortIndex'] = $optionPosition;
                            $items[$optionLabel]['value']          = $option['value'];
                        }
                    }
                }
            }

            $items = $this->sortOptionsData($items);
        }

        return $items;
    }
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) {
                    if (isset($option['label'])) {
                        // Manage labels that contains single quote.
                        $optionLabel = trim((string) htmlspecialchars($option['label'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', false));
                        $optionPosition++;

                        if ($optionLabel !== null && isset($items[$optionLabel])) {
                            $items[$optionLabel]['adminSortIndex'] = $optionPosition;
                            $items[$optionLabel]['value']          = $option['value'];
                        }
                    }
                }
            }

            $items = $this->sortOptionsData($items);
        }

        return $items;
    }
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 ) { if ( isset ( $ option [ 'label' ] ) ) { // Manage labels that contains single quote. $ optionLabel = trim ( ( string ) htmlspecialchars ( $ option [ 'label' ] , ENT_QUOTES | ENT_SUBSTITUTE , 'UTF-8' , false ) ) ; $ optionPosition ++ ; if ( $ optionLabel !== null && isset ( $ items [ $ optionLabel ] ) ) { $ items [ $ optionLabel ] [ 'adminSortIndex' ] = $ optionPosition ; $ items [ $ optionLabel ] [ 'value' ] = $ option [ 'value' ] ; } } } } $ items = $ this -> sortOptionsData ( $ items ) ; } return $ items ; }
Resort items according option position defined in admin.

@param array $items Items to be sorted.

@return array
Resort items according option position defined in admin .