1 views_ui.admin.inc views_ui_build_preview($view, $display_id, $render = TRUE)

File

core/modules/views_ui/views_ui.admin.inc, line 984
Admin page callbacks for the Views UI module.

Code

function views_ui_build_preview($view, $display_id, $render = TRUE) {
  if (isset($_POST['ajax_html_ids'])) {
    unset($_POST['ajax_html_ids']);
  }

  $build = array(
    '#theme_wrappers' => array('container'),
    '#attributes' => array('id' => 'views-preview-wrapper', 'class' => 'views-admin clearfix'),
  );

  $form_state = array('build_info' => array('args' => array($view, $display_id)));
  $build['controls'] = backdrop_build_form('views_ui_preview_form', $form_state);

  $args = array();
  if (!empty($form_state['values']['view_args'])) {
    $args = explode('/', $form_state['values']['view_args']);
  }

  $build['preview'] = array(
    '#theme_wrappers' => array('container'),
    '#attributes' => array('id' => 'views-live-preview'),
    '#markup' => $render ? views_ui_preview($view->clone_view(), $display_id, $args) : '',
  );

  return $build;
}