Loading modules/facets_summary/config/schema/facets_summary.facets_summary.schema.yml +3 −0 Changes for modules/facets_summary/config/schema/facets_summary.facets_summary.schema.yml: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -11,6 +11,9 @@ facets_summary.facets_summary.*: facet_source_id: type: string label: 'Facet source id' only_visible_when_facet_source_is_visible: type: boolean label: 'Show this summary only when the facet source is visible.' processor_configs: type: sequence label: 'Processor settings' Loading modules/facets_summary/config/schema/facets_summary.processor.schema.yml +0 −3 Changes for modules/facets_summary/config/schema/facets_summary.processor.schema.yml: 0 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -4,9 +4,6 @@ plugin.plugin_configuration.facets_summary_processor.show_summary: plugin.plugin_configuration.facets_summary_processor.show_count: type: config_object plugin.plugin_configuration.facets_summary_processor.hide_when_not_rendered: type: config_object plugin.plugin_configuration.facets_summary_processor.show_text_when_empty: type: mapping label: 'No results behavior' Loading modules/facets_summary/facets_summary.install +21 −0 Changes for modules/facets_summary/facets_summary.install: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -50,3 +50,24 @@ function facets_summary_update_8002(&$sandbox = NULL) { return $update; }); } /** * Replace facet source rendered processor by facet summary property. */ function facets_summary_update_8003(&$sandbox = NULL) { \Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'facets_summary', function ($facets_summary) { $update = FALSE; if ($facets_summary instanceof FacetsSummaryInterface) { $processor_settings = $facets_summary->getProcessorConfigs(); if (isset($processor_settings['hide_when_not_rendered'])) { $facets_summary->setOnlyVisibleWhenFacetSourceIsVisible(TRUE); $facets_summary->removeProcessor('hide_when_not_rendered'); $update = TRUE; } } return $update; }); } modules/facets_summary/src/Entity/FacetsSummary.php +25 −0 Changes for modules/facets_summary/src/Entity/FacetsSummary.php: 25 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ use Drupal\facets_summary\FacetsSummaryInterface; * "name", * "facets", * "facet_source_id", * "only_visible_when_facet_source_is_visible", * "processor_configs", * }, * links = { Loading Loading @@ -107,6 +108,16 @@ class FacetsSummary extends ConfigEntityBase implements FacetsSummaryInterface { */ protected $weight; /** * Is the facet only visible when the facet source is only visible. * * A boolean that defines if the facet summary is only visible when the facet * source is visible. * * @var bool */ protected $only_visible_when_facet_source_is_visible = FALSE; /** * {@inheritdoc} */ Loading Loading @@ -256,6 +267,20 @@ class FacetsSummary extends ConfigEntityBase implements FacetsSummaryInterface { return $return_processors; } /** * {@inheritdoc} */ public function setOnlyVisibleWhenFacetSourceIsVisible($only_visible_when_facet_source_is_visible) { $this->only_visible_when_facet_source_is_visible = $only_visible_when_facet_source_is_visible; } /** * {@inheritdoc} */ public function getOnlyVisibleWhenFacetSourceIsVisible() { return $this->only_visible_when_facet_source_is_visible; } /** * {@inheritdoc} */ Loading modules/facets_summary/src/FacetsSummaryInterface.php +17 −0 Changes for modules/facets_summary/src/FacetsSummaryInterface.php: 17 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -120,6 +120,23 @@ interface FacetsSummaryInterface extends ConfigEntityInterface { */ public function getProcessorConfigs(); /** * Sets the "only visible when facet source is visible" boolean flag. * * @param bool $only_visible_when_facet_source_is_visible * A boolean flag indicating if the facet should be hidden on a page that * does not show the facet source. */ public function setOnlyVisibleWhenFacetSourceIsVisible($only_visible_when_facet_source_is_visible); /** * Returns the "only visible when facet source is visible" boolean flag. * * @return bool * True when the facet is only shown on a page with the facet source. */ public function getOnlyVisibleWhenFacetSourceIsVisible(); /** * Adds a processor for this facet. * Loading Loading
modules/facets_summary/config/schema/facets_summary.facets_summary.schema.yml +3 −0 Changes for modules/facets_summary/config/schema/facets_summary.facets_summary.schema.yml: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -11,6 +11,9 @@ facets_summary.facets_summary.*: facet_source_id: type: string label: 'Facet source id' only_visible_when_facet_source_is_visible: type: boolean label: 'Show this summary only when the facet source is visible.' processor_configs: type: sequence label: 'Processor settings' Loading
modules/facets_summary/config/schema/facets_summary.processor.schema.yml +0 −3 Changes for modules/facets_summary/config/schema/facets_summary.processor.schema.yml: 0 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -4,9 +4,6 @@ plugin.plugin_configuration.facets_summary_processor.show_summary: plugin.plugin_configuration.facets_summary_processor.show_count: type: config_object plugin.plugin_configuration.facets_summary_processor.hide_when_not_rendered: type: config_object plugin.plugin_configuration.facets_summary_processor.show_text_when_empty: type: mapping label: 'No results behavior' Loading
modules/facets_summary/facets_summary.install +21 −0 Changes for modules/facets_summary/facets_summary.install: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -50,3 +50,24 @@ function facets_summary_update_8002(&$sandbox = NULL) { return $update; }); } /** * Replace facet source rendered processor by facet summary property. */ function facets_summary_update_8003(&$sandbox = NULL) { \Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'facets_summary', function ($facets_summary) { $update = FALSE; if ($facets_summary instanceof FacetsSummaryInterface) { $processor_settings = $facets_summary->getProcessorConfigs(); if (isset($processor_settings['hide_when_not_rendered'])) { $facets_summary->setOnlyVisibleWhenFacetSourceIsVisible(TRUE); $facets_summary->removeProcessor('hide_when_not_rendered'); $update = TRUE; } } return $update; }); }
modules/facets_summary/src/Entity/FacetsSummary.php +25 −0 Changes for modules/facets_summary/src/Entity/FacetsSummary.php: 25 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ use Drupal\facets_summary\FacetsSummaryInterface; * "name", * "facets", * "facet_source_id", * "only_visible_when_facet_source_is_visible", * "processor_configs", * }, * links = { Loading Loading @@ -107,6 +108,16 @@ class FacetsSummary extends ConfigEntityBase implements FacetsSummaryInterface { */ protected $weight; /** * Is the facet only visible when the facet source is only visible. * * A boolean that defines if the facet summary is only visible when the facet * source is visible. * * @var bool */ protected $only_visible_when_facet_source_is_visible = FALSE; /** * {@inheritdoc} */ Loading Loading @@ -256,6 +267,20 @@ class FacetsSummary extends ConfigEntityBase implements FacetsSummaryInterface { return $return_processors; } /** * {@inheritdoc} */ public function setOnlyVisibleWhenFacetSourceIsVisible($only_visible_when_facet_source_is_visible) { $this->only_visible_when_facet_source_is_visible = $only_visible_when_facet_source_is_visible; } /** * {@inheritdoc} */ public function getOnlyVisibleWhenFacetSourceIsVisible() { return $this->only_visible_when_facet_source_is_visible; } /** * {@inheritdoc} */ Loading
modules/facets_summary/src/FacetsSummaryInterface.php +17 −0 Changes for modules/facets_summary/src/FacetsSummaryInterface.php: 17 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -120,6 +120,23 @@ interface FacetsSummaryInterface extends ConfigEntityInterface { */ public function getProcessorConfigs(); /** * Sets the "only visible when facet source is visible" boolean flag. * * @param bool $only_visible_when_facet_source_is_visible * A boolean flag indicating if the facet should be hidden on a page that * does not show the facet source. */ public function setOnlyVisibleWhenFacetSourceIsVisible($only_visible_when_facet_source_is_visible); /** * Returns the "only visible when facet source is visible" boolean flag. * * @return bool * True when the facet is only shown on a page with the facet source. */ public function getOnlyVisibleWhenFacetSourceIsVisible(); /** * Adds a processor for this facet. * Loading