You are here

public function FacetapiDependency::__construct in Facet API 7

Same name and namespace in other branches
  1. 6.3 plugins/facetapi/dependency.inc \FacetapiDependency::__construct()
  2. 7.2 plugins/facetapi/dependency.inc \FacetapiDependency::__construct()

Constructs a FacetapiDependency object.

Sets the necessary information in order to check a facet's dependencies.

Parameters

array $id: The machine name of the dependency plugin being instantiated as defined in hook_facetapi_dependencies() implementations.

FacetapiAdapter $adapter: The adapter associated with facet whose dependencies are being checked.

array $facet: The facet definition as returned by facetapi_facet_load().

array $active_items: The facet's active items returned by FacetapiAdapter::getActiveItems().

stdClass $settings: The facet's global settings.

File

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

Class

FacetapiDependency
Abstract class extended by dependency plugins.

Code

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;

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