Problem/Motivation

Currently to inject facets into views area user require to create block placement (and hide it), then use to add it with non-intuitive interface by providing block id.

Proposed resolution

Add area plugin per search api view to allow display set of configured facets for the view

Remaining tasks

- review implmentation
- clean-up filtering for facet source
- add tests

User interface changes

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
StatusFileSize
new4.2 KB
andypost’s picture

Just discovered that load multiple does not sort facets according their weight... looking how to fix

andypost’s picture

StatusFileSize
new1.34 KB
new4.49 KB

Here is sorting & admin label to display enabled facets

borisson_’s picture

+++ b/src/Plugin/views/area/Facets.php
@@ -0,0 +1,125 @@
+    foreach ($facets as $facet) {
+      if ($facet->getFacetSourceId() === $source) {
+        $options[$facet->id()] = $facet->label();
+      }
+    }

I think we can do this with an array_filter instead, but that is just preference.

As you mentioned in the IS, this also needs tests.

svendecabooter’s picture

StatusFileSize
new4.53 KB

Updated the patch in #4 to also work with Views displays other than the "page" display.

chr.fritsch’s picture

Maybe we should try to render the facets as blocks, that would give us the ajax support for free.

hugronaphor’s picture

@chr.fritsch I would really want Facets module to not be tight to Block plugins. But seems like this needs quite a decent refactoring.

borisson_’s picture

Maybe we should try to render the facets as blocks, that would give us the ajax support for free.

That would probably be somewhat easier yeah, especially on maintenance down the line.

@chr.fritsch I would really want Facets module to not be tight to Block plugins. But seems like this needs quite a decent refactoring.

Yeah that's not going to happen any time soon. A big rewrite like this will probably only happen when someone hands me a boatload of money.\

geek-merlin’s picture

swentel’s picture

Status: Needs review » Closed (duplicate)

Indeed, closing this. We made the decision to rip out the old AJAX implementation and go for views plugins completely.
Will move this plugin inside the patch over at #3073444: Create views plugins to render facets and summaries in filters and areas

- actually - do we still need to have an area plugin or not?

andypost’s picture

Area plugins are more useful when you need to place configurable list of facets for each page