Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using views_get_view() and $view->set_exposed_input() to build a view in code.
The view has an attachment which inherits the exposed filters. The inheritance works fine when the view is displayed as a page, but when rendered through the views_get_view() the attachment ignores the exposed filters that are being set:
$view = views_get_view('landmarks');
$view->set_exposed_input(array('circle' => array('value' => 10, 'location' => 'Boston')));
$view->build('page_1');
$return = $view->preview();
Comments
Comment #1
rickmanelius CreditAttribution: rickmanelius commentedIs this still an issue in 6.x-2.16?
Comment #2
Crell CreditAttribution: Crell commentedWhy are you using views_attach if you're building a view in code yourself? That makes no sense.
Comment #3
rickmanelius CreditAttribution: rickmanelius commentedThat's true re:#3. I was thinking of just closing this as a "won't fix" but wanted to see if it wasn't something that was already resolved many versions ago. Thanks @Crell.
Comment #4
Crell CreditAttribution: Crell at Platform.sh for Acquia commented