You are here

public function FacetapiFacet::getActiveValues in Facet API 6

Returns an array of the facet's active item values, most useful as a form element's default value.

Return value

An array containing the facet values keyed by position.

File

./facetapi.adapter.inc, line 310
Defines classes used by the FacetAPI module.

Class

FacetapiFacet
Stores facet data, provides methods that build the facet's render array.

Code

public function getActiveValues() {
  if (!isset($this->_active)) {
    $this
      ->processActiveItems();
  }
  $values = array();
  foreach ($this->_active as $value => $item) {
    $values[$item['pos']] = $value;
  }
  if (!empty($values)) {
    $values = array_combine($values, $values);
  }
  return $values;
}