You are here

function panopoly_magic_preview_callback_default in Panopoly Magic 7

Default 'preview callback' for widgets when we can't find something more specific.

1 string reference to 'panopoly_magic_preview_callback_default'
_panopoly_magic_render_preview_pane in ./panopoly_magic.module
Helper function to display the pane for showing previews in the add_content modal

File

./panopoly_magic.module, line 1597

Code

function panopoly_magic_preview_callback_default($type, $subtype, $plugin, $renderer) {
  $pane = panels_new_pane($type, $subtype, TRUE);

  // Mix in requested settings.
  if (!empty($plugin['preview settings'])) {
    $pane->configuration = array_merge($pane->configuration, $plugin['preview settings']);
  }
  $display = $renderer->display;
  $context = $renderer->display->context;
  $args = $renderer->display->args;
  $incoming_content = $renderer->display->incoming_content;
  $keywords = !empty($renderer->display->keywords) ? $renderer->display->keywords : array();
  $content = ctools_content_render($pane->type, $pane->subtype, $pane->configuration, $keywords, $args, $context, $incoming_content);
  if ($content) {
    return theme('panels_pane', array(
      'content' => $content,
      'pane' => $pane,
      'display' => $display,
    ));
  }
}