public function findFilterOptionsToDisplay($filter)
    {
        $options = array();

        foreach ($filter['options'] as $option) {
            // should we check if the filter option is available in
            // the current search result?

            if ($this->conf['checkFilterCondition'] != 'none') {
                // Once one filter option has been selected, don't display the
                // others anymore since this leads to a strange behaviour (options are
                // only displayed if they have BOTH tags: the selected and the other filter option.
                if ((!count($filter['selectedOptions'])
                        || in_array($option['uid'], $filter['selectedOptions'])
                    ) && $this->filters->checkIfTagMatchesRecords($option['tag'])
                ) {
                    // build link which selects this option and keeps all the other selected filters
                    unset($linkconf);
                    $linkconf['parameter'] = $GLOBALS['TSFE']->id;
                    $linkconf['additionalParams'] = '&tx_kesearch_pi1[sword]='
                        . $this->piVars['sword']
                        . '&tx_kesearch_pi1[filter]['
                        . $filter['uid']
                        . ']='
                        . $option['tag'];
                    $linkconf['useCacheHash'] = false;
                    if (is_array($this->piVars['filter']) && count($this->piVars['filter'])) {
                        foreach ($this->piVars['filter'] as $key => $value) {
                            if ($key != $filter['uid']) {
                                $linkconf['additionalParams'] .= '&tx_kesearch_pi1[filter][' . $key . ']=' . $value;
                            }
                        }
                    }
                    $optionLink = $this->cObj->typoLink_URL($linkconf);

                    $options[$option['uid']] = array(
                        'title' => $option['title'],
                        'value' => $option['tag'],
                        'results' => $this->tagsInSearchResult[$option['tag']],
                        'selected' => is_array($filter['selectedOptions'])
                            && in_array($option['uid'], $filter['selectedOptions']),
                        'link' => $optionLink
                    );
                }
            } else {
                // do not process any checks; show all filter options
                $options[$option['uid']] = array(
                    'title' => $option['title'],
                    'value' => $option['tag'],
                    'selected' =>
                        is_array($filter['selectedOptions'])
                        && !empty($filter['selectedOptions'])
                        && in_array($option['uid'], $filter['selectedOptions']),
                );
            }
        }

        return $options;
    }
public function findFilterOptionsToDisplay($filter)
    {
        $options = array();

        foreach ($filter['options'] as $option) {
            // should we check if the filter option is available in
            // the current search result?

            if ($this->conf['checkFilterCondition'] != 'none') {
                // Once one filter option has been selected, don't display the
                // others anymore since this leads to a strange behaviour (options are
                // only displayed if they have BOTH tags: the selected and the other filter option.
                if ((!count($filter['selectedOptions'])
                        || in_array($option['uid'], $filter['selectedOptions'])
                    ) && $this->filters->checkIfTagMatchesRecords($option['tag'])
                ) {
                    // build link which selects this option and keeps all the other selected filters
                    unset($linkconf);
                    $linkconf['parameter'] = $GLOBALS['TSFE']->id;
                    $linkconf['additionalParams'] = '&tx_kesearch_pi1[sword]='
                        . $this->piVars['sword']
                        . '&tx_kesearch_pi1[filter]['
                        . $filter['uid']
                        . ']='
                        . $option['tag'];
                    $linkconf['useCacheHash'] = false;
                    if (is_array($this->piVars['filter']) && count($this->piVars['filter'])) {
                        foreach ($this->piVars['filter'] as $key => $value) {
                            if ($key != $filter['uid']) {
                                $linkconf['additionalParams'] .= '&tx_kesearch_pi1[filter][' . $key . ']=' . $value;
                            }
                        }
                    }
                    $optionLink = $this->cObj->typoLink_URL($linkconf);

                    $options[$option['uid']] = array(
                        'title' => $option['title'],
                        'value' => $option['tag'],
                        'results' => $this->tagsInSearchResult[$option['tag']],
                        'selected' => is_array($filter['selectedOptions'])
                            && in_array($option['uid'], $filter['selectedOptions']),
                        'link' => $optionLink
                    );
                }
            } else {
                // do not process any checks; show all filter options
                $options[$option['uid']] = array(
                    'title' => $option['title'],
                    'value' => $option['tag'],
                    'selected' =>
                        is_array($filter['selectedOptions'])
                        && !empty($filter['selectedOptions'])
                        && in_array($option['uid'], $filter['selectedOptions']),
                );
            }
        }

        return $options;
    }
public function findFilterOptionsToDisplay ( $ filter ) { $ options = array ( ) ; foreach ( $ filter [ 'options' ] as $ option ) { // should we check if the filter option is available in // the current search result? if ( $ this -> conf [ 'checkFilterCondition' ] != 'none' ) { // Once one filter option has been selected, don't display the // others anymore since this leads to a strange behaviour (options are // only displayed if they have BOTH tags: the selected and the other filter option. if ( ( ! count ( $ filter [ 'selectedOptions' ] ) || in_array ( $ option [ 'uid' ] , $ filter [ 'selectedOptions' ] ) ) && $ this -> filters -> checkIfTagMatchesRecords ( $ option [ 'tag' ] ) ) { // build link which selects this option and keeps all the other selected filters unset ( $ linkconf ) ; $ linkconf [ 'parameter' ] = $ GLOBALS [ 'TSFE' ] -> id ; $ linkconf [ 'additionalParams' ] = '&tx_kesearch_pi1[sword]=' . $ this -> piVars [ 'sword' ] . '&tx_kesearch_pi1[filter][' . $ filter [ 'uid' ] . ']=' . $ option [ 'tag' ] ; $ linkconf [ 'useCacheHash' ] = false ; if ( is_array ( $ this -> piVars [ 'filter' ] ) && count ( $ this -> piVars [ 'filter' ] ) ) { foreach ( $ this -> piVars [ 'filter' ] as $ key => $ value ) { if ( $ key != $ filter [ 'uid' ] ) { $ linkconf [ 'additionalParams' ] .= '&tx_kesearch_pi1[filter][' . $ key . ']=' . $ value ; } } } $ optionLink = $ this -> cObj -> typoLink_URL ( $ linkconf ) ; $ options [ $ option [ 'uid' ] ] = array ( 'title' => $ option [ 'title' ] , 'value' => $ option [ 'tag' ] , 'results' => $ this -> tagsInSearchResult [ $ option [ 'tag' ] ] , 'selected' => is_array ( $ filter [ 'selectedOptions' ] ) && in_array ( $ option [ 'uid' ] , $ filter [ 'selectedOptions' ] ) , 'link' => $ optionLink ) ; } } else { // do not process any checks; show all filter options $ options [ $ option [ 'uid' ] ] = array ( 'title' => $ option [ 'title' ] , 'value' => $ option [ 'tag' ] , 'selected' => is_array ( $ filter [ 'selectedOptions' ] ) && ! empty ( $ filter [ 'selectedOptions' ] ) && in_array ( $ option [ 'uid' ] , $ filter [ 'selectedOptions' ] ) , ) ; } } return $ options ; }
find out which filter options should be displayed for the given filter
check filter options availability and preselection status
@param array $filter
@return array
@author Christian Bülter <buelter@kennziffer.com>
@since 09.09.14
find out which filter options should be displayed for the given filter check filter options availability and preselection status