You are here

class FacetapiFilterCurrentDepth in Facet API 7.2

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

Plugin that filters all items not in current hierarchy.

For hierarchical facets such as taxonomy, it might be advantageous to only display the current level of the hierarchy to implement the progressive disclosure pattern inside of the facet. For example, if your taxonomy tree is Make -> Model -> Year for cars, you might want to only display one level at a time. After selecting a make, users should only be presented with the available models.

Hierarchy

Expanded class hierarchy of FacetapiFilterCurrentDepth

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

File

plugins/facetapi/filter.inc, line 141
Base filter class and core implementations.

View source
class FacetapiFilterCurrentDepth extends FacetapiFilter {

  /**
   * Implements FacetapiFilter::execute().
   */
  public function execute(array $build) {
    foreach ($build as $item) {
      if ($item['#active'] && !empty($item['#item_children'])) {
        return $this
          ->execute($item['#item_children']);
      }
    }
    return $build;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FacetapiFilter::$adapter protected property The adapter associated with facet being filtered.
FacetapiFilter::$id protected property The machine name of the plugin associated with this instance.
FacetapiFilter::$settings protected property The facet settings.
FacetapiFilter::getDefaultSettings public function Provides default values for the plugin settings.
FacetapiFilter::settingsForm public function Allows the plugin to add settings to the dependency form.
FacetapiFilter::__construct public function Constructs a FacetapiFilter object.
FacetapiFilterCurrentDepth::execute public function Implements FacetapiFilter::execute(). Overrides FacetapiFilter::execute