You are here

function panels_ipe_edit_control_form in Panels 6.3

Same name and namespace in other branches
  1. 7.3 panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php \panels_ipe_edit_control_form()

FAPI callback to create the Save/Cancel form for the IPE.

1 string reference to 'panels_ipe_edit_control_form'
panels_renderer_ipe::ajax_save_form in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
AJAX entry point to create the controller form for an IPE.

File

panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php, line 212

Code

function panels_ipe_edit_control_form(&$form_state) {
  $display =& $form_state['display'];

  // @todo -- this should be unnecessary as we ensure cache_key is set in add_meta()
  //  $display->cache_key = isset($display->cache_key) ? $display->cache_key : $display->did;
  // Annoyingly, theme doesn't have access to form_state so we have to do this.
  $form['#display'] = $display;
  $layout = panels_get_layout($display->layout);
  $layout_panels = panels_get_regions($layout, $display);
  $form['panel'] = array(
    '#tree' => TRUE,
  );
  $form['panel']['pane'] = array(
    '#tree' => TRUE,
  );
  foreach ($layout_panels as $panel_id => $title) {

    // Make sure we at least have an empty array for all possible locations.
    if (!isset($display->panels[$panel_id])) {
      $display->panels[$panel_id] = array();
    }
    $form['panel']['pane'][$panel_id] = array(
      // Use 'hidden' instead of 'value' so the js can access it.
      '#type' => 'hidden',
      '#default_value' => implode(',', (array) $display->panels[$panel_id]),
    );
  }
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#id' => 'panels-ipe-save',
    '#submit' => array(
      'panels_edit_display_form_submit',
    ),
    '#save-display' => TRUE,
  );
  $form['buttons']['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#id' => 'panels-ipe-cancel',
  );
  return $form;
}