interface FacetSourcePluginInterface in Facets 8
Describes a source for facet items.
A facet source is used to abstract the data source where facets can be added to. A good example of this is a Search API view. There are other possible facet data sources, these all implement the FacetSourcePluginInterface.
Hierarchy
- interface \Drupal\Core\Plugin\PluginFormInterface; interface \Drupal\Component\Plugin\DependentPluginInterface
- interface \Drupal\facets\FacetSource\FacetSourcePluginInterface
Expanded class hierarchy of FacetSourcePluginInterface
All classes that implement FacetSourcePluginInterface
See also
3 files declare their use of FacetSourcePluginInterface
- HideWhenNotRenderedProcessorTest.php in modules/
facets_summary/ tests/ src/ Unit/ Plugin/ Processor/ HideWhenNotRenderedProcessorTest.php - ListItemProcessorTest.php in tests/
src/ Unit/ Plugin/ processor/ ListItemProcessorTest.php - QueryStringTest.php in tests/
src/ Unit/ Plugin/ url_processor/ QueryStringTest.php
File
- src/
FacetSource/ FacetSourcePluginInterface.php, line 18
Namespace
Drupal\facets\FacetSourceView source
interface FacetSourcePluginInterface extends PluginFormInterface, DependentPluginInterface {
/**
* Fills the facet entities with results from the facet source.
*
* @param \Drupal\facets\FacetInterface[] $facets
* The configured facets.
*/
public function fillFacetsWithResults(array $facets);
/**
* Returns the allowed query types for a given facet for the facet source.
*
* @param \Drupal\facets\FacetInterface $facet
* The facet we should get query types for.
*
* @return string[]
* array of allowed query types
*
* @throws \Drupal\facets\Exception\Exception
* An error when no query types are found.
*/
public function getQueryTypesForFacet(FacetInterface $facet);
/**
* Returns the path of the facet source, used to build the facet url.
*
* @return string
* The path.
*/
public function getPath();
/**
* Returns the number of results that were found for this search.
*
* @return string
* The path of the facet.
*/
public function getCount();
/**
* Returns true if the Facet source is being rendered in the current request.
*
* This function will define if all facets for this facet source are shown
* when facet source visibility: "being rendered" is configured in the facet
* visibility settings.
*
* @return bool
* True when the facet is rendered on the same page.
*/
public function isRenderedInCurrentRequest();
/**
* Returns an array of fields that are defined on the facet source.
*
* This returns an array of fields that are defined on the source. This array
* is keyed by the field's machine name and has values of the field's label.
*
* @return array
* An array of available fields.
*/
public function getFields();
/**
* Sets the search keys, or query text, submitted by the user.
*
* @param string $keys
* The search keys, or query text, submitted by the user.
*
* @return self
* An instance of this class.
*/
public function setSearchKeys($keys);
/**
* Returns the search keys, or query text, submitted by the user.
*
* @return string
* The search keys, or query text, submitted by the user.
*/
public function getSearchKeys();
/**
* Returns a single field's data definition from the facet source.
*
* @return \Drupal\Core\TypedData\DataDefinitionInterface
* A typed data definition.
*/
public function getDataDefinition($field_name);
/**
* Builds and returns an extra renderable array for this facet block plugin.
*
* @return array
* A renderable array representing the content of the block.
*
* @see \Drupal\facets\Plugin\facets\facet_source\SearchApiDisplay
*/
public function buildFacet();
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependentPluginInterface:: |
public | function | Calculates dependencies for the configured plugin. | 19 |
FacetSourcePluginInterface:: |
public | function | Builds and returns an extra renderable array for this facet block plugin. | 1 |
FacetSourcePluginInterface:: |
public | function | Fills the facet entities with results from the facet source. | 1 |
FacetSourcePluginInterface:: |
public | function | Returns the number of results that were found for this search. | 1 |
FacetSourcePluginInterface:: |
public | function | Returns a single field's data definition from the facet source. | 1 |
FacetSourcePluginInterface:: |
public | function | Returns an array of fields that are defined on the facet source. | 1 |
FacetSourcePluginInterface:: |
public | function | Returns the path of the facet source, used to build the facet url. | 1 |
FacetSourcePluginInterface:: |
public | function | Returns the allowed query types for a given facet for the facet source. | 1 |
FacetSourcePluginInterface:: |
public | function | Returns the search keys, or query text, submitted by the user. | 1 |
FacetSourcePluginInterface:: |
public | function | Returns true if the Facet source is being rendered in the current request. | 1 |
FacetSourcePluginInterface:: |
public | function | Sets the search keys, or query text, submitted by the user. | 1 |
PluginFormInterface:: |
public | function | Form constructor. | 36 |
PluginFormInterface:: |
public | function | Form submission handler. | 32 |
PluginFormInterface:: |
public | function | Form validation handler. | 18 |