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();
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

luizsgpetri’s picture

luizsgpetri’s picture

Assigned: luizsgpetri » Unassigned
luizsgpetri’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 1: add_getter_to_related_view_2385735_1.patch, failed testing.

luizsgpetri’s picture

luizsgpetri’s picture

luizsgpetri’s picture

Status: Needs work » Needs review
luizsgpetri’s picture

FileSize
2.44 KB

New patch

The last submitted patch, 6: add_getter_to_related_view_2385735_2.patch, failed testing.

MiroslavBanov’s picture

Status: Needs review » Closed (fixed)

Applied patch. Only change is passing array() instead of '' to $context.

Thanks for the contribution.

MiroslavBanov’s picture

Status: Closed (fixed) » Fixed

Oops 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 the context of the view itself.

  • MiroslavBanov committed 73b0a69 on 7.x-1.x
    Issue #2385735 by luizsgpetri, MiroslavBanov: Add context for view on...
MiroslavBanov’s picture

Actually decided to add context as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

luizsgpetri’s picture

luizsgpetri’s picture

luizsgpetri’s picture