Rescoped
We have some processors that absolutely require a processor or setting to be enabled to work correctly.
This issue adds the ability for a widget to say what settings / prcoessors are required.
original scope
At this moment we always show all processors in the widget display UI.
Since there are many processors which are not relevant for e.g. a range widget, it might be a good idea to hide them in the UI (and not enable them either for performance reasons).
2 options we can do to tackle this
- Create a notCompatibleProcessorIds() function in the widget interface/base class, which certain widgets can implement.
- The other way around, create a nonCompatibleWidget() function in the processor interface/base class.
For me it makes the most sense to implement this function on the widget level.
We can create a hook_alter in this function, so contrib can add their own non-compatible processors to existing widgets.
Comment | File | Size | Author |
---|---|---|---|
#41 | give_widgets_the-2611198-41.patch | 9.47 KB | borisson_ |
Comments
Comment #2
StryKaizerComment #3
borisson_Comment #4
StryKaizerPostponed, I'll investigate if there are processors which will break the widget if activated.
Comment #5
StryKaizerComment #6
borisson_Removing tag, was discussed in the facetapi hangout of 09/11.
If there are processors that'll break a widget, we could add this.
Otherwise, we could add "not recommended".
Comment #7
borisson_Changing category to reflect that this is a feature.
Comment #8
StryKaizerComment #9
borisson_I started working on this, because I figured we were going to need this to make sure only 1 active item was shown for the dropdown widget, turns out that limiting to only 1 active item is something that's not a processor. So leaving my work here but not doing any more work on this for now. This works but needs extra tests before it can be committed and an alter hook in the methods.
Comment #10
joshi.rohit100That sounds great. Don't know if already exist or not or right place but there should also be some way to define if a plugin is compatible to the the field/data type (may be by annotation). I am porting range slider (https://github.com/joshirohit100/facet_slider) and seems like it should only be available for number or date/timestamp field/datatype
Comment #11
mollux CreditAttribution: mollux commented@borisson_ and I discussed this, and we agreed that for the moment we only see a use case for requiring certain processors or settings to be active.
I created a wip patch that provides the basics for this functionality.
it lacks the functionality to require the processors and settings when changing the widget. This should be done with some ajax (just as the widget specific settings).
This functionality is needed for the slider widget, as the 'Make sure only one result can be shown.' widget setting should always be enabled.
Comment #12
borisson_Setting to needs review for the testbot. Also changing priority now that we have a use-case.
Comment #15
mollux CreditAttribution: mollux commentedI made a typo, added new patch an interdiff
Comment #16
borisson_I'd love to also get tests for this functionality, I can work on those if needed. Back to NW for tests.
Comment #17
borisson_This only applied with
git apply -C 2 mark_certain_processors-2611198-13.patch
. So new patch attached.Comment #18
borisson_cs fixes.
Comment #19
borisson_NR, for tests.
Comment #20
borisson_Start of integration test, but nothing happens really. Not sure if I did it right.
Comment #21
borisson_Back to NW for the additional tests.
Comment #22
borisson_Test's red now. @mollux, am I doing it right?
Comment #25
borisson_Rebased.
Comment #27
borisson_Updated IS to say what we're actually working on here.
Comment #28
borisson_Comment #30
borisson_The new test is green locally. So that's great. Let's see how the bots feel
Comment #31
borisson_Comment #32
borisson_It took me ~5 months but the tests here are green again! I feel this is sufficient for now. Since this is an API break - I'd like to get this in before tagging the first beta.
Comment #33
Nick_vhShould this get a phpstorm codehint?
This code gets quite long, should we break it out?
When using api functions it is preferable they follow the chain. Eg, first define the type and then the variable to check.
isPropertyRequired('processor', 'processor-to-check') instead of the reverse.
Are the ( and ) needed here? Doesn't add much for readability.
Are the ( and ) needed here? Doesn't add much for readability.
Does this actually return true or a value? Careful to pass unexpected values. Certainly because this is a plugin type that developers can create themselves.
Comment #34
borisson_@Nick_vh
Reroll attached
Comment #36
borisson_Discussed this with nick, we should use a value object instead of an array here.
Comment #37
borisson_Discussed this with @mollux, we decided to trash
requiredFacetProperties
Comment #39
borisson_Updated IS.
Comment #40
borisson_Fixes the test.
Comment #41
borisson_Adds extra docs.
Comment #43
borisson_Committed, thanks!