PATCH: Base URL not set if not a "Page" display, defaults to $_GET['q'] instead of nothing

careernerd - November 12, 2009 - 19:45
Project:Apache Solr Views
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:careernerd
Status:needs work
Description

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'];

#1

DamienMcKenna - November 20, 2009 - 00:54

Here's an actual patch file.

AttachmentSize
apachesolr_views-n631238.patch 1021 bytes

#2

Scott Reynolds - November 20, 2009 - 00:55
Status:needs review» needs work

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

#3

Scott Reynolds - November 20, 2009 - 01:20

lets check the display and see if it uses hook menu

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

#4

smoothify - December 13, 2009 - 13:15

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

smoothify - December 13, 2009 - 14:08

here is a patch for #4

AttachmentSize
apachesolr_views_base_url.patch 656 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.