Facets has supported rest and block displays for a while now, but since we're rebuilding on the ViewsPageDisplayDeriver, we can't support those anymore.
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | 2799475-31--cleanup.patch | 4.15 KB | drunken monkey |
| #26 | support_block_and_rest-2799475-26.patch | 20.38 KB | borisson_ |
Comments
Comment #2
borisson_Comment #3
drunken monkeyHm, interesting. I guess if we do this, we should either rename the display plugin to just "Views" (not "Views Page"), or create two new plugins for blocks and REST displays. (I guess I'd prefer the second variant – and with some small change, they could still all use the same deriver.)
Also, while supporting REST displays makes perfect sense, I'd say blocks are a bit of a special case for a "search display" – specifically, because they have no fixed path. We even have a
getPath()method on the interface (though I don't know why that's notgetUrl()), currently with no option to returnNULL– what should that be for blocks?I guess it can make sense, on a site, to define a search in a block, and then of course you might still want facets (or other stuff, e.g., autocompletion) for that search – but then we probably have to re-think display plugins a bit. At the very least, that one method. Which is really a pity, with the module now being in Beta, but I guess that can't be helped.
Comment #4
borisson_We resolved this in facets like this, I just noticed that we don't do anything for rest displays.
I guess seperate plugins make sense, I can make that change tonight.
Comment #5
drunken monkeyOK, I guess that will work fine for facets functionality in most cases. And really nothing better we can do there, I'd say (except spy into the block settings to see if it's enabled only for a certain path – but that's hacky, unreliable and just overkill, I'd say).
However, for search display plugins, I think just returning the current path there is pretty misleading. If you want to, e.g., show a list of all known search pages, it would have a link to that list for block displays. Being able to just return
NULLseems to make more sense to me in that case. Just have to deal with that case in your Search API facet source plugin, I guess.Comment #6
borisson_Ok, so for this issue to be in a better state we should:
I can work on those things tonight, anything else I need to do?
Comment #7
drunken monkeygetPath()doesn't return a string but a URL. That's why I want to rename it. But yeah, I guess we should deprecate it instead and remove it only in RC phase.Otherwise, yeah, seems like this should do it. Thanks!
Do you already have a solution for
isRenderedInCurrentRequest()for blocks?Comment #8
borisson_Comment #9
borisson_Add rest + block plugins.
Comment #10
borisson_Comment #11
drunken monkeyThanks a lot!
Here are a few style changes plus nit-picking, but generally this already looks quite good.
I'm wondering, though, whether we can keep the static caching as-is in the deriver, with
$this->derivatives? Seems like that would cache the derivatives for one of the three display types and then return them for the other two, too. Did you test whether this really works like this? Otherwise, we'll probably have to go back (cf. #2758321: Clean up deriver code) to keying the cached definitions by base plugin ID, too.If you have some time, could you maybe also add tests for this to the Views test? I guess you'd just need to add a block and a REST display to the view and check they have corresponding search display plugins, too.
Comment #12
borisson_Sure, I have time set aside tonight to work on this and #2794745: Use Search API's display plugin to fix facets, so I'll start by adding test coverage for this.
Comment #13
borisson_This adds the requested tests.
Comment #15
borisson_Add rest module to failing tests.
Comment #16
borisson_I added a failing test to the viewstest to show that this work as expected yet.
Comment #18
borisson_Comment #20
borisson_Tests should be green now.
Comment #22
nick_vhforeach{ if { foreach { if { while {
This is pretty complex to read. Can't we simplify this a bit so this becomes easier to read and easier to maintain?
This is pretty scary to read :) So what if this is suddenly the case? Should we add a testcase for this?
Comment #23
borisson_Fixed failing test by adding rest as dependency + also fixed Nick's remark (with his help - here at DrupalCon).
Comment #25
borisson_Comment #26
borisson_Sorry, the interdiff also includes the changes from #25. But this is another cleanup.
Comment #27
nick_vhTagging RTBC. Because this is one of the last blockers to get FacetAPI back up and running I vote to get this committed unless someone shouts really loud with a clear reason why not to do this.
Comment #29
nick_vhCommitted. Thanks everyone!
Comment #31
drunken monkeyThanks for fixing this, and sorry I wasn't there to help.
Just have a few minor code style changes/corrections to propose for this.
Comment #32
borisson_No worries, we all need some time off every once in a while :)
I agree with the changes - they look good.
Comment #34
drunken monkeyGood to hear, thanks for reviewing!
Committed.