You are here

function panels_edit_display_form_preview in Panels 7.3

Same name and namespace in other branches
  1. 6.3 includes/display-edit.inc \panels_edit_display_form_preview()

Submission of the preview button. Render the preview and put it into the preview widget area.

2 string references to 'panels_edit_display_form_preview'
panels_edit_display_form in includes/display-edit.inc
Form definition for the panels display editor.
panels_layouts_ui::edit_form in plugins/export_ui/panels_layouts_ui.class.php
Provide the actual editing form.

File

includes/display-edit.inc, line 188
Core Panels API include file containing various display-editing functions. This includes all the basic editing forms (content, layout, layout settings) as well as the ajax modal forms associated with them.

Code

function panels_edit_display_form_preview(&$form, &$form_state) {
  $display =& $form_state['display'];
  ctools_include('ajax');
  $display->context = ctools_context_replace_placeholders($display->context, $form_state['values']['preview']);
  $display->skip_cache = TRUE;
  $output = panels_render_display($display);

  // Add any extra CSS that some layouts may have added specifically for this.
  if (!empty($display->add_css)) {
    $output = "<style type=\"text/css\">\n{$display->add_css}</style>\n" . $output;
  }
  $commands = array();
  $commands[] = array(
    'command' => 'panel_preview',
    'output' => $output,
  );
  print ajax_render($commands);
  ajax_footer();
  exit;
}