abstract class FacetapiUrlProcessor in Facet API 6.3
Same name and namespace in other branches
- 7.2 plugins/facetapi/url_processor.inc \FacetapiUrlProcessor
- 7 plugins/facetapi/url_processor.inc \FacetapiUrlProcessor
Hierarchy
- class \FacetapiUrlProcessor
Expanded class hierarchy of FacetapiUrlProcessor
1 string reference to 'FacetapiUrlProcessor'
- facetapi_facetapi_url_processors in ./
facetapi.facetapi.inc - Implements hook_facetapi_url_processors().
File
- plugins/
facetapi/ url_processor.inc, line 11 - Adapter and standard plugin class.
View source
abstract class FacetapiUrlProcessor {
/**
* The adapter.
*
* @var FacetapiAdapter
*/
protected $adapter;
/**
* An array of facet params.
*
* @var array.
*/
protected $params = array();
/**
* The key containing the facet filters.
*
* @var string
*/
protected $filterKey = 'f';
/**
*
*/
public function __construct(FacetapiAdapter $adapter) {
$this->adapter = $adapter;
}
/**
* Automatically fetches the params when the plugin is instantiated.
*
* @return array
* An array containing the params.
*/
public abstract function fetchParams();
/**
* Normalizes the array returned by FacetapiAdapter::fetchParams().
*
* @param array $params
* An array of keyed params, such as $_GET.
* @param string $filter_key
* The array key in $params corresponding to filters.
*
* @return array
* An array containing the normalized params.
*/
public abstract function normalizeParams(array $params, $filter_key = 'f');
/**
* Returns the query string variables for a facet item.
*
* @param array $facet
* The facet definition.
* @param array $values
* An array containing the item's values being added to or removed from the
* query string dependent on whether or not the item is active.
* @param int $active
* An integer flagging whether the item is active or not.
*
* @return array
* The query string vriables.
*/
public abstract function getQueryString(array $facet, array $values, $active);
/**
* Returns the path for a facet item.
*
* @param array $facet
* The facet definition.
* @param array $values
* An array containing the item's values being added to or removed from the
* query string dependent on whether or not the item is active.
* @param int $active
* An integer flagging whether the item is active or not.
*
* @return string
* The path of the facet.
*/
public function getFacetPath(array $facet, array $values, $active) {
return $this->adapter
->getSearchPath();
}
/**
* Sets the breadcrumb trail on searches.
*/
public abstract function setBreadcrumb();
/**
* Sets the parameters.
*
* @param array $params
* An array of normalized params.
* @param string $filter_key
* The array key in $params corresponding to filters.
*
* @return FacetapiUrlParser
* An instance of this class.
*/
public function setParams(array $params, $filter_key = 'f') {
$this->params = $params;
$this->filterKey = $filter_key;
if (!isset($this->params[$this->filterKey]) || !is_array($this->params[$this->filterKey])) {
$this->params[$this->filterKey] = array();
}
return $this;
}
/**
* Returns the params.
*
* @return array
* An array containing the params.
*/
public function getParams() {
return $this->params;
}
/**
* Removes an item from the $this->params array.
*/
public function removeParam($pos) {
unset($this->params[$this->filterKey][$pos]);
}
/**
* Returns the filter key.
*
* @return string
* A string containing the filter key.
*/
public function getFilterKey() {
return $this->filterKey;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FacetapiUrlProcessor:: |
protected | property | The adapter. | |
FacetapiUrlProcessor:: |
protected | property | The key containing the facet filters. | |
FacetapiUrlProcessor:: |
protected | property | An array of facet params. | |
FacetapiUrlProcessor:: |
abstract public | function | Automatically fetches the params when the plugin is instantiated. | 1 |
FacetapiUrlProcessor:: |
public | function | Returns the path for a facet item. | |
FacetapiUrlProcessor:: |
public | function | Returns the filter key. | |
FacetapiUrlProcessor:: |
public | function | Returns the params. | |
FacetapiUrlProcessor:: |
abstract public | function | Returns the query string variables for a facet item. | 1 |
FacetapiUrlProcessor:: |
abstract public | function | Normalizes the array returned by FacetapiAdapter::fetchParams(). | 1 |
FacetapiUrlProcessor:: |
public | function | Removes an item from the $this->params array. | |
FacetapiUrlProcessor:: |
abstract public | function | Sets the breadcrumb trail on searches. | 1 |
FacetapiUrlProcessor:: |
public | function | Sets the parameters. | |
FacetapiUrlProcessor:: |
public | function |