Closed (outdated)
Project:
Facets
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
26 Oct 2015 at 14:25 UTC
Updated:
31 Jul 2017 at 19:23 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
borisson_This patch is not empty.
Comment #3
borisson_Postponing on #2600442: Add support for Facet Api in Drupal 8 and #2602606: Create a date query type for facetapi.
Comment #4
borisson_This needs a test as well, but first we need to get #2611812: Create a date query type in before work on this can go on.
Comment #5
strykaizerComment #6
strykaizerComment #7
jespermb commentedHi, I have been working on this a bit since drupalcon dublin, its not done yet but I thought I would share my progress. The filters for -1 day, -1 month and -1 year works but the custom range is not yet ready. I am looking into making something similar to what Google does, but to begin with it might be fine to have 2 text fields.
I just updated my work with the latest patch from https://www.drupal.org/node/2611812
If someone want to have a look and advise if i am going in the right direktion it would be welcome. :)
Comment #8
borisson_Back to active, the query type is committed. Haven't reviewed #7 yet, but I'm assuming it'll need a reroll. Setting to needs review to remind myself to do the actual review.
Comment #10
borisson_Patch still applies, is in both the new "facets" as well as the very old "facetapi" namespaces.
We'll also need tests. Architecturally this looks solid though.
Comment #11
borisson_At the very least - there should be a unit test per widget added here that extends
WidgetTestBaseonce that's added from #2838236: Add widget unit test base + basic coverage for all widgets.Comment #12
yeebot commentedI've tested the patch from #7 against 8.x-1.0-alpha7 and it worked for me although when I attempted to save a date range widget facet I got the following 500 error:
PHP message: PHP Fatal error: Declaration of Drupal\facets\Plugin\facets\widget\DateBasicWidget::getQueryType($query_types) must be compatible with Drupal\facets\Widget\WidgetPluginInterface::getQueryType(array $query_types) in /home/vagrant/shared/csp-d8/web/modules/contrib/facets/src/Plugin/facets/widget/DateBasicWidget.php on line 20I managed to fix this after applying the same changes as seen in the patch from #4 from https://www.drupal.org/node/2838234. to facets/src/Plugin/facets/widget/DateRangeWidget.php i.e.
Comment #13
jespermb commentedThanks for the update. I will try to get that in this weekend and create a test for the widget. :)
Comment #14
borisson_Adding the test should probably be easier with the new base class, a unit test that extends
\Drupal\Tests\facets\Unit\Plugin\widget\WidgetTestBaseshould be a good start. Have a look at\Drupal\Tests\facets\Unit\Plugin\widget\NumericGranularWidgetTestas an example.Thanks for your continued work on this @jespermb!
Comment #15
jespermb commentedI have updated the patch so it applies to the latest dev and I created a basic test. I was wondering what to include in the test? Do you have any suggestions on what should be tested? I am working on a form for the custom time selection and I think i have a solution which i will try to include soon.
Comment #16
borisson_I think this is a good start and we can probably commit this patch and improve the tests as new bug reports trickle in. Going to ask @ekes for a review of this one.
Comment #17
acbramley commentedIn my testing this isn't really functional at the moment. All I get is a list of 3 links "Last day", "Last month", "Last year" with no select options for from/to dates. Selecting an option does filter the results correctly but doesn't show any way to remove the filter (e.g the (-) sign in front of the link).
Small code review:
Need to use the site/user timezone here.
Comment #18
edysmpThe form is rendering empty.
Comment #19
dennis cohn commentedNice one! Applied patch #15 with succes.
With the date range you've only got dates from the past:
'Last day', Last month' & 'Last year'.
But when you've got an events view (for example), you want to have facets with dates in the future.
Can we makes this configurable? Or do we need to make another 'relative date selection'
Comment #20
borisson_Closing this issue in favor of #2896229: move date handling to a processor, so date facets can use existing widgets, as that makes this issue redundant.