function views_ui_build_preview

3.x admin.inc views_ui_build_preview($view, $display_id, $render = TRUE)
1 call to views_ui_build_preview()
views_ui_edit_page in includes/admin.inc
Page callback for the Edit View page.
1 string reference to 'views_ui_build_preview'

File

includes/admin.inc, line 933
Provides the Views' administrative interface.

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'] = drupal_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;
}