You are here

function asset_widget_get_search_form in Asset 7

Build search form renderable array.

1 string reference to 'asset_widget_get_search_form'
asset_widget_get_tabs_info in modules/asset_widget/asset_widget.module
Return all possible widget tabs to render.

File

modules/asset_widget/asset_widget.module, line 495
Code for the Asset widget module.

Code

function asset_widget_get_search_form($filter_params = array()) {
  $view = views_get_view(variable_get('asset_widget_search_view_name', 'asset_widget_search'));

  // If we have filter params e.g. for saved search, we set it to view.
  if (!empty($filter_params)) {
    parse_str($filter_params, $filter_params);
    $view->exposed_input = $filter_params;
  }
  $view
    ->set_display('default');
  $view
    ->init_handlers();
  $exposed_form = $view->display_handler
    ->get_plugin('exposed_form');

  // Our exposed plugin could be rendered only if flag setted.
  $view->render_exposed_form = TRUE;

  // Handle prefilled params on init form load.
  if ($filter_params) {
    asset_widget_set_current_command(array(
      'command' => 'assetWidgetSetFilterParams',
      'data' => $filter_params,
    ));
  }
  return array(
    '#markup' => $exposed_form
      ->render_exposed_form(),
  );
}