summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorborisson_2018-07-31 17:54:08 (GMT)
committerJoris Vercammen2018-07-31 17:54:08 (GMT)
commit43af879b6bcba9e1b73501153367617fdcbee625 (patch)
tree85076d5764c97f863d3dcf7879e3b16400beff8f
parent36bb4a2405003bf92650f97c17459a0a0b6acea8 (diff)
Issue #2978535 by borisson_, andreasderijcke, Nick_vh: Facet Summary: "Hide Summary when Facet Source is not rendered" doesn't work8.x-1.1
-rw-r--r--modules/facets_summary/src/Plugin/facets_summary/processor/HideWhenNotRenderedProcessor.php2
-rw-r--r--modules/facets_summary/src/Plugin/facets_summary/processor/ResetFacetsProcessor.php2
-rw-r--r--modules/facets_summary/src/Plugin/facets_summary/processor/ShowCountProcessor.php2
-rw-r--r--modules/facets_summary/src/Plugin/facets_summary/processor/ShowSummaryProcessor.php2
-rw-r--r--modules/facets_summary/src/Plugin/facets_summary/processor/ShowTextWhenEmptyProcessor.php2
-rw-r--r--modules/facets_summary/tests/src/Kernel/ProcessorTest.php45
6 files changed, 50 insertions, 5 deletions
diff --git a/modules/facets_summary/src/Plugin/facets_summary/processor/HideWhenNotRenderedProcessor.php b/modules/facets_summary/src/Plugin/facets_summary/processor/HideWhenNotRenderedProcessor.php
index 880026d..2f41f67 100644
--- a/modules/facets_summary/src/Plugin/facets_summary/processor/HideWhenNotRenderedProcessor.php
+++ b/modules/facets_summary/src/Plugin/facets_summary/processor/HideWhenNotRenderedProcessor.php
@@ -15,7 +15,7 @@ use Drupal\facets_summary\Processor\ProcessorPluginBase;
* description = @Translation("When checked, this facet will only be rendered when the facet source is rendered. If you want to show facets on other pages too, you need to uncheck this setting."),
* default_enabled = TRUE,
* stages = {
- * "build" = 10
+ * "build" = 45
* }
* )
*/
diff --git a/modules/facets_summary/src/Plugin/facets_summary/processor/ResetFacetsProcessor.php b/modules/facets_summary/src/Plugin/facets_summary/processor/ResetFacetsProcessor.php
index 0752b76..4d9f057 100644
--- a/modules/facets_summary/src/Plugin/facets_summary/processor/ResetFacetsProcessor.php
+++ b/modules/facets_summary/src/Plugin/facets_summary/processor/ResetFacetsProcessor.php
@@ -17,7 +17,7 @@ use Drupal\facets_summary\Processor\ProcessorPluginBase;
* label = @Translation("Adds reset facets link."),
* description = @Translation("When checked, this facet will add a link to reset enabled facets."),
* stages = {
- * "build" = 50
+ * "build" = 30
* }
* )
*/
diff --git a/modules/facets_summary/src/Plugin/facets_summary/processor/ShowCountProcessor.php b/modules/facets_summary/src/Plugin/facets_summary/processor/ShowCountProcessor.php
index 5da385b..2fc9427 100644
--- a/modules/facets_summary/src/Plugin/facets_summary/processor/ShowCountProcessor.php
+++ b/modules/facets_summary/src/Plugin/facets_summary/processor/ShowCountProcessor.php
@@ -14,7 +14,7 @@ use Drupal\facets_summary\Processor\ProcessorPluginBase;
* label = @Translation("Show a summary of how many results were found"),
* description = @Translation("When checked, this will show the amount of results found."),
* stages = {
- * "build" = 50
+ * "build" = 5
* }
* )
*/
diff --git a/modules/facets_summary/src/Plugin/facets_summary/processor/ShowSummaryProcessor.php b/modules/facets_summary/src/Plugin/facets_summary/processor/ShowSummaryProcessor.php
index eb17ccb..83313a5 100644
--- a/modules/facets_summary/src/Plugin/facets_summary/processor/ShowSummaryProcessor.php
+++ b/modules/facets_summary/src/Plugin/facets_summary/processor/ShowSummaryProcessor.php
@@ -14,7 +14,7 @@ use Drupal\facets_summary\Processor\ProcessorPluginBase;
* label = @Translation("Show a summary of all selected facets"),
* description = @Translation("When checked, this facet will show an imploded list of all selected facets."),
* stages = {
- * "build" = 50
+ * "build" = 20
* }
* )
*/
diff --git a/modules/facets_summary/src/Plugin/facets_summary/processor/ShowTextWhenEmptyProcessor.php b/modules/facets_summary/src/Plugin/facets_summary/processor/ShowTextWhenEmptyProcessor.php
index fe23d39..0c4f1f7 100644
--- a/modules/facets_summary/src/Plugin/facets_summary/processor/ShowTextWhenEmptyProcessor.php
+++ b/modules/facets_summary/src/Plugin/facets_summary/processor/ShowTextWhenEmptyProcessor.php
@@ -16,7 +16,7 @@ use Drupal\facets_summary\Processor\ProcessorPluginBase;
* description = @Translation("Show a text when there are no results, otherwise it will hide the block."),
* default_enabled = TRUE,
* stages = {
- * "build" = 30
+ * "build" = 10
* }
* )
*/
diff --git a/modules/facets_summary/tests/src/Kernel/ProcessorTest.php b/modules/facets_summary/tests/src/Kernel/ProcessorTest.php
new file mode 100644
index 0000000..bc344d7
--- /dev/null
+++ b/modules/facets_summary/tests/src/Kernel/ProcessorTest.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace Drupal\Tests\facets_summary\Kernel;
+
+use Drupal\KernelTests\KernelTestBase;
+
+/**
+ * Class ProcessorTest.
+ *
+ * @group facets
+ */
+class ProcessorTest extends KernelTestBase {
+
+ /**
+ * {@inheritdoc}
+ */
+ public static $modules = [
+ 'facets',
+ 'facets_summary',
+ ];
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUp() {
+ parent::setUp();
+ $this->installEntitySchema('facets_facet');
+ $this->installEntitySchema('facets_summary');
+ }
+
+ /**
+ * Tests that the "hide when not rendered" processors is last.
+ */
+ public function testHideWhenNotRenderedIsLast() {
+ /** @var \Drupal\facets_summary\Processor\ProcessorPluginManager $processor_manager */
+ $processor_manager = $this->container->get('plugin.manager.facets_summary.processor');
+ $defs = $processor_manager->getDefinitions();
+ $hide_when_not_rendered_weight = $defs['hide_when_not_rendered']['stages']['build'];
+ unset($defs['hide_when_not_rendered']);
+ foreach ($defs as $def) {
+ $this->assertLessThan($hide_when_not_rendered_weight, $def['stages']['build']);
+ }
+ }
+
+}