Hello there - We're using this module and it's quite nice.
Small question: would you accept a patch to add the sandbox attribute to this?
/**
* Alternate submit callback for the node form "Preview" button.
*/
function pagepreview_node_form_build_preview($form, &$form_state) {
$node = node_form_submit_build_node($form, $form_state);
$node->pagepreview = TRUE;
// Get the expected URL alias from Pathauto, if applicable.
if (module_exists('pathauto') && (!isset($node->path['pathauto']) || $node->path['pathauto'])) {
module_load_include('inc', 'pathauto');
$src = "node/" . $node->nid;
$alias = pathauto_create_alias('node', 'return', $src, array('node' => $node), $node->type, $node->language);
if ($alias) {
$node->path['alias'] = $alias;
}
}
// Cache the temporary node and active the preview area of the node form.
$preview_id = md5(json_encode($form_state['values']) . mt_rand());
cache_set($preview_id, $node, 'cache_pagepreview', CACHE_TEMPORARY);
$form_state['node_preview'] = '<iframe class="pagepreview-preview" src="' . base_path() . 'pagepreview/' . $preview_id . '" sandbox></iframe>'; //could do this a number of different ways...
$form_state['rebuild'] = TRUE;
}