Closed (outdated)
Project:
Facets
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
31 Aug 2016 at 10:26 UTC
Updated:
20 Mar 2022 at 09:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
christianadamski commentedWhat about multiple dependencies? As in, more than one other facet?
Comment #3
borisson_That's not yet implemented but sounds like a great feature!
Comment #4
christianadamski commentedLet's see if this actually passes existing tests. Probably not.
Reworked condition settings like this:
- list all existing facets as a single checkbox each
- present a condition "mode" selection
-- facet present (current behavior)
-- facet not empty (point of this issue)
-- specific facet values enabled (see #2784945)
- you can choose to negate this for every facet
- settings will only show up when facet condition itself is enabled (#states form handling)
This rework allows the users to
- create a hierarchy of facets
- depend on more than one facet
- define multiple values to be set (#2784945)
TODO:
- Tests. None are added, existing ones not touched
- Wording, descriptions, etc. - Somebody natively English speaking would be good
- Styling (?)
- Rename this condition? "Other facet" is not really that helpful. Maybe just "Facets"?
Comment #5
christianadamski commentedTODO: Oh, and updating existing settings, if that is an issue
Comment #7
christianadamski commentedTests hopefully fixed.
Comment #9
christianadamski commentedOtherFacetTest locally passes. IntegrationTest gives weired results probably unrelated to this.
Comment #11
christianadamski commentedK, this is hopefully it. Cannot test IntegrationTest locally, as it effectively requires 8.2
Comment #12
christianadamski commentedLeftover TODOs:
- Review
- Wording, descriptions, etc. - Somebody natively English speaking would be good
- Styling (?)
- Rename this condition? "Other facet" is not really that helpful. Maybe just "Facets"?
- updating existing settings, if that is an issue
Please provide feedback.
Comment #13
borisson_From the leftover todo's in #12.
- Review.
I'll do that when work's done (so later today). For upcoming patches please also provide interdiffs, I had taken a look at the first patch but have no idea about the changes since.
- Wording, descriptions, etc. - Somebody natively English speaking would be good.
I'm not a native english speaker but I'll have a look as part of the review.
- Styling (?)
Not sure if that'll be needed, this should all be drupal core's task? I'll have a look at how it looks during review so we might have to add some changes our selves or open a core-issue.
- Rename this condition? "Other facet" is not really that helpful. Maybe just "Facets"?
Yeah, that makes sense I guess.
- updating existing settings, if that is an issue
Not while we haven't reached the beta phase, no. We'll start providing upgrade paths as soon as we hit beta. But that won't happen before Search Api reaches beta.
Comment #14
christianadamski commentedOver in Core Views Facets I already implemented AJAX handling. Specifically, when Views refreshes via AJAX, the facets using that view as source will also be updated.
I now run into the issue, that facet-blocks using this condition are simply not present, so can't be updated of course, even though the facet content itself is available.
This is not relevant when doing a full page-load on each click, but once facets introduces AJAX handling, it will become an issue.
I have yet to come up with a workable approach to this.
Comment #15
borisson_Overall this is looking good, I had some nitpicks though.
Let's use
$this->t()here instead.I like this change, much clearer!
This comment is not very useful, let's remove it or replace it with something that happens in the code.
This looks like it's indented very weird.
Comment #16
mpp commentedChanged title as this patch also covers the problem of multiple facets in #2784945.
Comment #17
mpp commentedFixed the following warning: Invalid argument supplied for foreach() in Drupal\facets\Plugin\Condition\OtherFacet->evaluate() (line 220 of modules/contrib/facets/src/Plugin/Condition/OtherFacet.php).
Comment #18
mpp commentedComment #19
mpp commentedAdded some help text to the UI.
Comment #21
ndrake86 commentedI tested out the latest patch and its working correctly for me. I was just thinking of a possible case where this function does something odd.
Say I have facet A and facet B with facet B only visible when facet A is selected. Currently if you have an item in facet A selected and and then select an item in facet B then unselect the item in facet A the selection for facet B is still selected but now it is hidden as the nothing is selected in facet A.
I was wondering if this should have be if the parent filter is unselected then all the dependent filters values that are only shown when the parent is selected are unselected.
I hope this sort of made some sense. I will attempt a patch later for this specific set of events but wanted to throw this out there.
Nick
Comment #22
dangelo5 commentedThis is looking great. I've been testing this out most of today.
I agree with @ndrake86. It would be awesome if when a user unselects a parent facet, then any dependent facet selections would be cleared. This is one area that threw me off initially and I think clearing the dependent filters when the parent is unselected would make the feature very usable.
Comment #29
borisson_Tests 'll need to be fixed for this as well. Otherwise I like the direction here.
Comment #30
mpp commentedNext to tests #19 needs a reroll (due to changes in #2834754).
Comment #31
mpp commentedRerolled #19.
Comment #32
borisson_Let's see what the testbot thinks.
Comment #34
jummonk commentedNew patch. Previous one failed because of ...
Comment #35
mpp commentedInterdiff:
- if (!is_array($enabled_conditions)) {
+ if (!is_array($enabled_conditions) || empty($enabled_conditions)) {
Comment #37
borisson_So, we're trying to rewrite the condition to a processor instead of an actual condition. I'm not sure if we should continue this work first. I'd say we should probably postpone this?
Comment #38
borisson_Postponing this on the work in #2796569: New Dependent Facet processor
Comment #39
borisson_The issue this was postponed on was committed recently. So work on this can start again.
Comment #40
borisson_Since this is now implemented as a processor - this is no longer a condition plugin. This feature still is a something we can improve but the current patch isn't really useable anymore.
Comment #41
mkalkbrenner