You are here

function embed_views_exposed_form in Embed Views Display 7.2

Returns the exposed filter widgets for a view.

Parameters

mixed $view: Either a string with the name of the view or an object of the view

string $display_id: An optional string with the name of the display for the view.

Return value

string The themed exposed filter form.

File

./embed_views.module, line 70
Integration with the views module to create the new embed views display.

Code

function embed_views_exposed_form($view, $display_id = '') {
  $destroy = FALSE;
  if (is_string($view) && $display_id != '') {
    $destroy = TRUE;
    $view = views_get_view($view);
    $view
      ->set_display((string) $display_id);
  }
  elseif ($display_id != '') {
    $view
      ->set_display((string) $display_id);
  }
  if (isset($view->display_handler)) {
    $exposed_filter = $view->display_handler
      ->embed_views_exposed_form();

    // Cleanup if we created.
    if ($destroy == '') {
      $view
        ->destroy();
    }
    return $exposed_filter;
  }
  else {
    watchdog('embed_views', t('You must set the display BEFORE you call embed_views_exposed_form().'), array(), WATCHDOG_ERROR);
  }
}