You are here

class FacetapiQueryType in Facet API 7

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

Base class for query type plugins.

Hierarchy

Expanded class hierarchy of FacetapiQueryType

File

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

View source
class FacetapiQueryType {

  /**
   * The adapter associated with facet being queried.
   *
   * @var FacetapiAdapter
   */
  protected $adapter;

  /**
   * The facet definition as returned by facetapi_facet_load().
   *
   * @var array
   */
  protected $facet;

  /**
   * Constructs a FacetapiQueryType object.
   *
   * @param FacetapiAdapter $adapter
   *   The adapter object associated with facet being queried.
   * @param array $facet
   *   The facet definition as returned by facetapi_facet_load().
   */
  public function __construct(FacetapiAdapter $adapter, array $facet) {
    $this->adapter = $adapter;
    $this->facet = $facet;
  }

  /**
   * Implements FacetapiQueryTypeInterface::extract().
   */
  public function extract(array $item) {
    return array();
  }

  /**
   * Convenience method to get the facet's global and per realm settings.
   *
   * @param string|array $realm
   *   The machine readable name of the realm or an array containing the realm
   *   definition. Pass NULL to return the facet's global settings.
   *
   * @return stdClass
   *   An object containing the settings.
   *
   * @see FacetapiFacet::getSettings()
   */
  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. See FacetapiAdapter::activeItems for the
   *   structure of the active item array.
   *
   * @see FacetapiAdapter::activeItems
   */
  public function getActiveItems() {
    return $this->adapter
      ->getActiveItems($this->facet);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FacetapiQueryType::$adapter protected property The adapter associated with facet being queried.
FacetapiQueryType::$facet protected property The facet definition as returned by facetapi_facet_load().
FacetapiQueryType::extract public function Implements FacetapiQueryTypeInterface::extract(). 2
FacetapiQueryType::getActiveItems public function Returns the facet's active items.
FacetapiQueryType::getSettings public function Convenience method to get the facet's global and per realm settings.
FacetapiQueryType::__construct public function Constructs a FacetapiQueryType object. 1