You are here

function theme_panels_edit_display_form in Panels 6.2

Theme the edit display form.

This has to do a fair bit of work since it's actually rendering the layout as well as ensuring that all of the gadgets go in the right place.

File

includes/display-edit.inc, line 176

Code

function theme_panels_edit_display_form($form) {
  $output = '';
  $content = array();
  $display = $form['#display'];
  $layout = panels_get_layout($display->layout);
  $layout_panels = panels_get_panels($layout, $display);
  $save_buttons = drupal_render($form['buttons']);
  foreach ($layout_panels as $panel_id => $title) {
    if (empty($content[$panel_id])) {
      $content[$panel_id] = '';
    }
    foreach ((array) $display->panels[$panel_id] as $pid) {
      $pane = $display->content[$pid];
      $left_buttons = NULL;
      $content[$pane->panel] .= panels_show_pane($display, $pane);
    }
    $panel_buttons = panels_ajax_image_button('icon-addcontent.png', "panels/ajax/add-pane/{$display->did}/{$panel_id}", t('Add a pane to "@panel"', array(
      '@panel' => $title,
    )), "pane-add-link");
    $content[$panel_id] = theme('panels_panel_dnd', $content[$panel_id], $panel_id, $title, $panel_buttons);
  }
  $output .= drupal_render($form);
  panels_load_include('display-render');
  $output .= theme('panels_dnd', panels_render_layout($layout, $content, '', $display->layout_settings));
  $output .= $save_buttons;
  return $output;
}