You are here

function panels_mini_export in Panels 5.2

Same name and namespace in other branches
  1. 6.3 panels_mini/panels_mini.module \panels_mini_export()
  2. 6.2 panels_mini/panels_mini.module \panels_mini_export()
  3. 7.3 panels_mini/panels_mini.module \panels_mini_export()

Export a mini panel into PHP code for use in import.

The code returned from can be used directly in panels_mini_save().

2 calls to panels_mini_export()
panels_mini_edit_export in panels_mini/panels_mini.module
Page callback to export a mini panel to PHP code.
panels_mini_panels_exportables in panels_mini/panels_mini.module
Implementation of hook_panels_exportables().

File

panels_mini/panels_mini.module, line 1160
panels_mini.module

Code

function panels_mini_export($panel_mini, $prefix = '') {
  $output = '';
  $fields = panels_mini_fields();
  $output .= $prefix . '$mini = new stdClass()' . ";\n";
  $output .= $prefix . '$mini->pid = \'new\'' . ";\n";
  foreach ($fields as $field => $sub) {
    $output .= $prefix . '  $mini->' . $field . ' = ' . panels_var_export($panel_mini->{$field}, '  ') . ";\n";
  }

  // Export the primary display
  $display = !empty($panel_mini->display) ? $panel_mini->display : panels_load_display($panel_mini->did);
  $output .= panels_export_display($display, $prefix);
  $output .= $prefix . '$mini->display = $display' . ";\n";
  return $output;
}