public function getSelectedFilterOptions($filter)
    {
        $selectedOptions = array();

        // run through all the filter options and check if one of them
        // has been selected.
        foreach ($filter['options'] as $option) {
            // Is the filter option selected in the frontend via piVars
            // or in the backend via flexform configuration ("preselected filters")?
            $selected = false;

            if ($this->pObj->piVars['filter'][$filter['uid']] == $option['tag']) {
                $selected = true;
            } elseif (is_array($this->pObj->piVars['filter'][$filter['uid']])) { // if a this filter is set
                // test pre selected filter again
                if (is_array($this->pObj->preselectedFilter)
                    && $this->pObj->in_multiarray($option['tag'], $this->pObj->preselectedFilter)) {
                    $selected = true;
                    // add preselected filter to piVars
                    $this->pObj->piVars['filter'][$filter['uid']][$option['uid']] = $option['tag'];
                } else { // else test all other filter
                    $isInArray = in_array($option['tag'], $this->pObj->piVars['filter'][$filter['uid']]);
                    if ($isInArray) {
                        $selected = true;
                    }
                }
            } elseif (!isset($this->pObj->piVars['filter'][$filter['uid']])
                && !is_array($this->pObj->piVars['filter'][$filter['uid']])
            ) {
                if (is_array($this->pObj->preselectedFilter)
                    && $this->pObj->in_multiarray($option['tag'], $this->pObj->preselectedFilter)
                ) {
                    $selected = true;
                    // add preselected filter to piVars
                    $this->pObj->piVars['filter'][$filter['uid']] = array($option['uid'] => $option['tag']);
                }
            }

            if ($selected) {
                $selectedOptions[] = $option['uid'];
            }
        }

        return $selectedOptions;
    }
public function getSelectedFilterOptions($filter)
    {
        $selectedOptions = array();

        // run through all the filter options and check if one of them
        // has been selected.
        foreach ($filter['options'] as $option) {
            // Is the filter option selected in the frontend via piVars
            // or in the backend via flexform configuration ("preselected filters")?
            $selected = false;

            if ($this->pObj->piVars['filter'][$filter['uid']] == $option['tag']) {
                $selected = true;
            } elseif (is_array($this->pObj->piVars['filter'][$filter['uid']])) { // if a this filter is set
                // test pre selected filter again
                if (is_array($this->pObj->preselectedFilter)
                    && $this->pObj->in_multiarray($option['tag'], $this->pObj->preselectedFilter)) {
                    $selected = true;
                    // add preselected filter to piVars
                    $this->pObj->piVars['filter'][$filter['uid']][$option['uid']] = $option['tag'];
                } else { // else test all other filter
                    $isInArray = in_array($option['tag'], $this->pObj->piVars['filter'][$filter['uid']]);
                    if ($isInArray) {
                        $selected = true;
                    }
                }
            } elseif (!isset($this->pObj->piVars['filter'][$filter['uid']])
                && !is_array($this->pObj->piVars['filter'][$filter['uid']])
            ) {
                if (is_array($this->pObj->preselectedFilter)
                    && $this->pObj->in_multiarray($option['tag'], $this->pObj->preselectedFilter)
                ) {
                    $selected = true;
                    // add preselected filter to piVars
                    $this->pObj->piVars['filter'][$filter['uid']] = array($option['uid'] => $option['tag']);
                }
            }

            if ($selected) {
                $selectedOptions[] = $option['uid'];
            }
        }

        return $selectedOptions;
    }
public function getSelectedFilterOptions ( $ filter ) { $ selectedOptions = array ( ) ; // run through all the filter options and check if one of them // has been selected. foreach ( $ filter [ 'options' ] as $ option ) { // Is the filter option selected in the frontend via piVars // or in the backend via flexform configuration ("preselected filters")? $ selected = false ; if ( $ this -> pObj -> piVars [ 'filter' ] [ $ filter [ 'uid' ] ] == $ option [ 'tag' ] ) { $ selected = true ; } elseif ( is_array ( $ this -> pObj -> piVars [ 'filter' ] [ $ filter [ 'uid' ] ] ) ) { // if a this filter is set // test pre selected filter again if ( is_array ( $ this -> pObj -> preselectedFilter ) && $ this -> pObj -> in_multiarray ( $ option [ 'tag' ] , $ this -> pObj -> preselectedFilter ) ) { $ selected = true ; // add preselected filter to piVars $ this -> pObj -> piVars [ 'filter' ] [ $ filter [ 'uid' ] ] [ $ option [ 'uid' ] ] = $ option [ 'tag' ] ; } else { // else test all other filter $ isInArray = in_array ( $ option [ 'tag' ] , $ this -> pObj -> piVars [ 'filter' ] [ $ filter [ 'uid' ] ] ) ; if ( $ isInArray ) { $ selected = true ; } } } elseif ( ! isset ( $ this -> pObj -> piVars [ 'filter' ] [ $ filter [ 'uid' ] ] ) && ! is_array ( $ this -> pObj -> piVars [ 'filter' ] [ $ filter [ 'uid' ] ] ) ) { if ( is_array ( $ this -> pObj -> preselectedFilter ) && $ this -> pObj -> in_multiarray ( $ option [ 'tag' ] , $ this -> pObj -> preselectedFilter ) ) { $ selected = true ; // add preselected filter to piVars $ this -> pObj -> piVars [ 'filter' ] [ $ filter [ 'uid' ] ] = array ( $ option [ 'uid' ] => $ option [ 'tag' ] ) ; } } if ( $ selected ) { $ selectedOptions [ ] = $ option [ 'uid' ] ; } } return $ selectedOptions ; }
Finds the selected filter options for a given filter.
Checks
- piVars one-dimensional filter
- piVars multi-dimensional filter
- backend preselected filter options
returns the filter options uids as values of an array or zero if no option has been selected.

@param array $filter
@return array
@author Christian Bülter <buelter@kennziffer.com>
@since 09.09.14
Finds the selected filter options for a given filter . Checks - piVars one - dimensional filter - piVars multi - dimensional filter - backend preselected filter options returns the filter options uids as values of an array or zero if no option has been selected .