Hello,
I'm not sure if that's the right place / project to ask this question, if not, please excuse me (and if possible re-route me to the proper place :))
I'm trying to retrieve the exposed filters form of a view display (in the current case the view display is a context one, still, I would like it to works for any kind of display) in order to rewrite the #action element as the exposed filters form gonna get rendered on any page, not especially on the one where the search results are (else I'll simply return the exposed element of the execute display method output I guess). BTW, I'm doing this in a "content_type_render" method as the module I'm working on aims to provide Search API Search forms (from search pages as well as from search views) as panes for panels.
I tried several ways of doing it (drupal_get_form, drupal_retrieve_form,...) and none works, is there something I'm missing ? (I feel like I'm missing a simple thing but didn't find what I'm missing after hours of search on drupal.org).
Thanks a lot for your help.
Regards,
JB
Comments
Comment #1
jbguerraz commentedComment #2
jbguerraz commentedHere is the code I tried to use but which raise an error :
$view_display = explode(':', $conf['search_pane_search_view']);
$view = views_get_view($view_display[0]);
$view->set_display($view_display[1]);
$view->init_handlers();
$form_state = array(
'view' => &$view,
'display' => &$view->display_handler->display,
'method' => 'get',
'rerender' => TRUE,
'no_redirect' => TRUE,
);
if (!$view->display_handler->displays_exposed()) {
unset($form_state['rerender']);
}
$form = drupal_build_form('views_exposed_form', $form_state);
The error is :
Fatal error: Call to a member function exposed_form_alter() on a non-object in /var/www/html/drupal/sites/all/modules/views/views.module on line 1781
Comment #3
jbguerraz commentedSee http://drupal.org/node/852882