In my current project we have build a module to add custom filters and export functionality in a Solr based views. After some time we have decided to add support to a custom entity and create a custom Solr dashboard/export for this entity too.
The problem is that we used hook_apachesolr_query_alter to handle our custom filters and in this hook there is no information about which views the ApachesolrViewsSolrBaseQuery object is related.
In order to be able to check the view name and display, I've updated the ApachesolrViewsSolrBaseQuery class to include the view object and provide a getter callback so we can get any information we want from the query related view.
$view = $query->getView();
Comment | File | Size | Author |
---|---|---|---|
#8 | add_getter_to_related_view_2385735_2.patch | 2.44 KB | luizsgpetri |
Comments
Comment #1
luizsgpetri CreditAttribution: luizsgpetri commentedComment #2
luizsgpetri CreditAttribution: luizsgpetri commentedComment #3
luizsgpetri CreditAttribution: luizsgpetri commentedComment #5
luizsgpetri CreditAttribution: luizsgpetri commentedComment #6
luizsgpetri CreditAttribution: luizsgpetri commentedComment #7
luizsgpetri CreditAttribution: luizsgpetri commentedComment #8
luizsgpetri CreditAttribution: luizsgpetri at CI&T for Pfizer, Inc. commentedNew patch
Comment #11
MiroslavBanov CreditAttribution: MiroslavBanov as a volunteer commentedApplied patch. Only change is passing
array()
instead of''
to$context
.Thanks for the contribution.
Comment #12
MiroslavBanov CreditAttribution: MiroslavBanov as a volunteer commentedOops incorrect status.
Just for the record. For the purposes of checking view name and display,
$context
argument would be perfectly good (and conceptually correct), but by passing the view, other things can also be done - like checking arguments that are passed, or even looking at thecontext
of the view itself.Comment #14
MiroslavBanov CreditAttribution: MiroslavBanov as a volunteer commentedActually decided to add context as well.
Comment #16
luizsgpetri CreditAttribution: luizsgpetri at CI&T for Pfizer, Inc. commentedComment #17
luizsgpetri CreditAttribution: luizsgpetri at CI&T for Pfizer, Inc. commentedComment #18
luizsgpetri CreditAttribution: luizsgpetri at CI&T for Pfizer, Inc. commented