Download & Extend

Use $view->get_path instead of grabing the path from the display

Project:Apache Solr Views
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:careernerd
Status:closed (fixed)

Issue Summary

This is a simple patch that came out of the need to use a solr view in a Panel. After some digging, I realized the base_path isn't being set right because it only looks for paths set by "Page display" views.

This patch changes the following line:

$this->_base_path = isset($view->display[$view->current_display]->display_options['path']) ? $view->display[$view->current_display]->display_options['path'] : '';

to this:
$this->_base_path = isset($view->display[$view->current_display]->display_options['path']) ? $view->display[$view->current_display]->display_options['path'] : $_GET['q'];

Comments

#1

Here's an actual patch file.

AttachmentSize
apachesolr_views-n631238.patch 1021 bytes

#2

Status:needs review» needs work

this is a problem the View is a block. Causes strange problems no?

#3

lets check the display and see if it uses hook menu

'uses hook menu' is the key. @see views_menu_alter().

#4

I ran into this problem too trying to use this module in a panel.

I fixed it by changing the same line from

$this->_base_path = isset($view->display[$view->current_display]->display_options['path']) ? $view->display[$view->current_display]->display_options['path'] : '';

to

$this->_base_path = $view->get_path();

This works with the panel as long as you set the path override in the pane settings. It also still works with the regular page view.

Is there reason i'm missing why this can't be used?

#5

here is a patch for #4

AttachmentSize
apachesolr_views_base_url.patch 656 bytes

#6

Title:PATCH: Base URL not set if not a "Page" display, defaults to $_GET['q'] instead of nothing» Use $view->get_path instead of grabing the path from the display
Status:needs work» fixed

http://drupal.org/cvs?commit=319094

#7

Status:fixed» closed (fixed)

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