Commit aca9c6af authored by borisson_'s avatar borisson_ Committed by borisson_

Issue #2913376 by borisson_: Facets Summary processor plugin docblocks need to be updated

parent 4dd25dc5
......@@ -7,7 +7,7 @@ use Drupal\facets_summary\Processor\BuildProcessorInterface;
use Drupal\facets_summary\Processor\ProcessorPluginBase;
/**
* Provides a processor that hides the facet when the facets were not rendered.
* Provides a processor that hides the summary when the source was not rendered.
*
* @SummaryProcessor(
* id = "hide_when_not_rendered",
......
......@@ -10,7 +10,7 @@ use Drupal\facets_summary\Processor\BuildProcessorInterface;
use Drupal\facets_summary\Processor\ProcessorPluginBase;
/**
* Provides a processor that allows to reset facet filters.
* Provides a processor that adds a link to reset facet filters.
*
* @SummaryProcessor(
* id = "reset_facets",
......
......@@ -7,7 +7,7 @@ use Drupal\facets_summary\Processor\BuildProcessorInterface;
use Drupal\facets_summary\Processor\ProcessorPluginBase;
/**
* Provides a processor that hides the facet when the facets were not rendered.
* Provides a processor that shows a summary of how many results were found.
*
* @SummaryProcessor(
* id = "show_count",
......
......@@ -7,7 +7,7 @@ use Drupal\facets_summary\Processor\BuildProcessorInterface;
use Drupal\facets_summary\Processor\ProcessorPluginBase;
/**
* Provides a processor that hides the facet when the facets were not rendered.
* Provides a processor that shows a summary of all selected facets.
*
* @SummaryProcessor(
* id = "show_summary",
......@@ -26,23 +26,25 @@ class ShowSummaryProcessor extends ProcessorPluginBase implements BuildProcessor
public function build(FacetsSummaryInterface $facets_summary, array $build, array $facets) {
$facets_config = $facets_summary->getFacets();
if (isset($build['#items'])) {
/** @var \Drupal\facets\Entity\Facet $facet */
foreach ($facets as $facet) {
if (empty($facet->getActiveItems())) {
continue;
}
$items = $this->getActiveDisplayValues($facet->getResults());
$facet_summary = [
'#theme' => 'facets_summary_facet',
'#label' => $facets_config[$facet->id()]['label'],
'#separator' => $facets_config[$facet->id()]['separator'],
'#items' => $items,
'#facet_id' => $facet->id(),
'#facet_admin_label' => $facet->getName(),
];
array_unshift($build['#items'], $facet_summary);
if (!isset($build['#items'])) {
return $build;
}
/** @var \Drupal\facets\Entity\Facet $facet */
foreach ($facets as $facet) {
if (empty($facet->getActiveItems())) {
continue;
}
$items = $this->getActiveDisplayValues($facet->getResults());
$facet_summary = [
'#theme' => 'facets_summary_facet',
'#label' => $facets_config[$facet->id()]['label'],
'#separator' => $facets_config[$facet->id()]['separator'],
'#items' => $items,
'#facet_id' => $facet->id(),
'#facet_admin_label' => $facet->getName(),
];
array_unshift($build['#items'], $facet_summary);
}
return $build;
}
......
......@@ -8,7 +8,7 @@ use Drupal\facets_summary\Processor\BuildProcessorInterface;
use Drupal\facets_summary\Processor\ProcessorPluginBase;
/**
* Provides a processor that hides the facet when the facets were not rendered.
* Provides a processor that shows a text when there are no results.
*
* @SummaryProcessor(
* id = "show_text_when_empty",
......@@ -28,17 +28,18 @@ class ShowTextWhenEmptyProcessor extends ProcessorPluginBase implements BuildPro
public function build(FacetsSummaryInterface $facets_summary, array $build, array $facets) {
$config = $this->getConfiguration();
if (!isset($build['#items'])) {
return [
'#theme' => 'facets_summary_empty',
'#message' => [
'#type' => 'processed_text',
'#text' => $config['text']['value'],
'#format' => $config['text']['format'],
],
];
if (isset($build['#items'])) {
return $build;
}
return $build;
return [
'#theme' => 'facets_summary_empty',
'#message' => [
'#type' => 'processed_text',
'#text' => $config['text']['value'],
'#format' => $config['text']['format'],
],
];
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment