You are here

abstract class FacetapiDependency in Facet API 6.3

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

Abstract class extended by dependency plugins.

Hierarchy

Expanded class hierarchy of FacetapiDependency

1 string reference to 'FacetapiDependency'
facetapi_facetapi_dependencies in ./facetapi.facetapi.inc
Implements hook_facetapi_dependencies().

File

plugins/facetapi/dependency.inc, line 11
Base dependency plugin class.

View source
abstract class FacetapiDependency {

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

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

  /**
   * An array of active items.
   *
   * @var array
   */
  protected $activeItems;

  /**
   * An array of facet settings.
   *
   * @var array
   */
  protected $settings;

  /**
   *
   *
   * @param FacetapiAdapter $adapter
   *
   * @param array $facet
   *
   * @param array $active_items
   *
   * @param stdClass $settings
   *
   * @param array $id
   *
   * @param array $label
   *
   */
  public function __construct($id, FacetapiAdapter $adapter, array $facet, stdClass $settings, array $active_items = array()) {
    $this->id = $id;
    $this->adapter = $adapter;
    $this->facet = $facet;
    $this->activeItems = $active_items;

    // Captures dependency settings only, makes sure defaults are set.
    if (empty($settings->settings['dependencies'])) {
      $settings->settings['dependencies'] = array();
    }
    $this->settings = $settings->settings['dependencies'];
    $this->settings += $this
      ->getDefaultSettings();
  }

  /**
   * Gets the id of the plugin.
   *
   * @return string
   *   The machine readable name of the plugin.
   */
  public function getId() {
    return $this->id;
  }

  /**
   * Gets the facet definition.
   *
   * @return array
   *   The facet definition.
   */
  public function getFacet() {
    return $this->facet;
  }

  /**
   * Performs the dependency check.
   *
   * @return boolean|NULL
   *   Return NULL to pass through to other dependency plugins, or return a
   *   boolean to explicitly set the result.
   */
  public abstract function execute();

  /**
   *
   */
  public function settingsForm(&$form, &$form_state) {

    // Nothing to do.
  }

  /**
   *
   */
  public function getDefaultSettings() {
    return array();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FacetapiDependency::$activeItems protected property An array of active items.
FacetapiDependency::$adapter protected property The adapter object.
FacetapiDependency::$facet protected property The facet definition.
FacetapiDependency::$settings protected property An array of facet settings.
FacetapiDependency::execute abstract public function Performs the dependency check. 2
FacetapiDependency::getDefaultSettings public function 2
FacetapiDependency::getFacet public function Gets the facet definition.
FacetapiDependency::getId public function Gets the id of the plugin.
FacetapiDependency::settingsForm public function 2
FacetapiDependency::__construct public function