You are here

class FacetapiQueryType in Facet API 6.3

Same name and namespace in other branches
  1. 7.2 plugins/facetapi/query_type.inc \FacetapiQueryType
  2. 7 plugins/facetapi/query_type.inc \FacetapiQueryType

Base class for query type plugins.

Hierarchy

Expanded class hierarchy of FacetapiQueryType

1 string reference to 'FacetapiQueryType'
facetapi_facetapi_query_types in ./facetapi.facetapi.inc

File

plugins/facetapi/query_type.inc, line 41
Interfaces and base classes for query type plugins.

View source
class FacetapiQueryType {

  /**
   * The adapter object.
   *
   * @var FacetapiAdapter
   */
  protected $adapter;

  /**
   * The facet definition.
   *
   * @var array
   */
  protected $facet;

  /**
   *
   * @param FacetapiAdapter $adapter
   *   The adapter object.
   */
  public function __construct(FacetapiAdapter $adapter, array $facet) {
    $this->adapter = $adapter;
    $this->facet = $facet;
  }

  /**
   * Allows additional information to be added to the active items.
   *
   * A common use case is extracting the start and end values in a range facet.
   *
   * @param array $value
   *   The active item.
   *
   * @return array
   *   An array containing the addition information to add to the item.
   */
  public function extract(array $item) {
    return array();
  }

  /**
   * Returns settings.
   *
   * @param string|array $realm
   *   The machine readable name of the realm or realm definition. Pass null to
   *   get global settings.
   *
   * @return
   *   An object containing the settings.
   */
  public function getSettings($realm = NULL) {
    return $this->adapter
      ->getFacet($this->facet)
      ->getSettings($realm);
  }

  /**
   * Returns the facet's active items.
   *
   * @return array
   *   The facet's active items.
   */
  public function getActiveItems() {
    return $this->adapter
      ->getActiveItems($this->facet);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FacetapiQueryType::$adapter protected property The adapter object.
FacetapiQueryType::$facet protected property The facet definition.
FacetapiQueryType::extract public function Allows additional information to be added to the active items. 2
FacetapiQueryType::getActiveItems public function Returns the facet's active items.
FacetapiQueryType::getSettings public function Returns settings.
FacetapiQueryType::__construct public function 1