You are here

abstract class FacetapiFilter in Facet API 6.3

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

Hierarchy

Expanded class hierarchy of FacetapiFilter

1 string reference to 'FacetapiFilter'
facetapi_facetapi_filters in ./facetapi.facetapi.inc
Implements hook_facetapi_filters().

File

plugins/facetapi/filter.inc, line 11
Base filter class and implementation.

View source
abstract class FacetapiFilter {

  /**
   * The ID of this plugin.
   */
  protected $id;

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

  /**
   * The facet settings.
   *
   * @var stdClass
   */
  protected $settings;

  /**
   * Initializes the filter object.
   *
   * @param array $adapter
   *   The adapter object
   * @param array $realm
   *   The realm being rendered.
   * @param array $settings
   *   The realm settings.
   * @param FacetapiFacet $facet
   *   The facet object.
   */
  public function __construct($id, FacetapiAdapter $adapter, stdClass $settings) {
    $this->id = $id;
    $this->adapter = $adapter;
    $this->settings = $settings;
    $this->settings->settings += $this
      ->getDefaultSettings();
  }

  /**
   * Filters the facet items.
   *
   * @param array $build
   *   The facet's render array.
   *
   * @return array
   *   The altered build array.
   */
  public abstract function execute(array $build);

  /**
   * Adds settings to the filter form.
   */
  public function settingsForm(&$form, &$form_state) {

    // Nothing to do.
  }

  /**
   * Returns default settings added to the settings form.
   */
  public function getDefaultSettings() {
    return array();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FacetapiFilter::$adapter protected property The adapter object.
FacetapiFilter::$id protected property The ID of this plugin.
FacetapiFilter::$settings protected property The facet settings.
FacetapiFilter::execute abstract public function Filters the facet items. 2
FacetapiFilter::getDefaultSettings public function Returns default settings added to the settings form.
FacetapiFilter::settingsForm public function Adds settings to the filter form.
FacetapiFilter::__construct public function Initializes the filter object.