public function FacetsSummaryBlock::getEntity in Facets 8
Returns the facets_summary entity associated with this derivative.
Return value
\Drupal\facets_summary\FacetsSummaryInterface The facets_summary entity.
Overrides FacetsSummaryBlockInterface::getEntity
1 call to FacetsSummaryBlock::getEntity()
- FacetsSummaryBlock::build in modules/
facets_summary/ src/ Plugin/ Block/ FacetsSummaryBlock.php - Builds and returns the renderable array for this block plugin.
File
- modules/
facets_summary/ src/ Plugin/ Block/ FacetsSummaryBlock.php, line 72
Class
- FacetsSummaryBlock
- Exposes a summary based on all the facets as a block.
Namespace
Drupal\facets_summary\Plugin\BlockCode
public function getEntity() {
if (!isset($this->facetsSummary)) {
$source_id = $this
->getDerivativeId();
if (!($this->facetsSummary = FacetsSummary::load($source_id))) {
$this->facetsSummary = FacetsSummary::create([
'id' => $source_id,
]);
$this->facetsSummary
->save();
}
}
return $this->facetsSummary;
}