You are here

function panels_edit_layout_settings_form in Panels 5.2

Same name and namespace in other branches
  1. 6.2 includes/display-layout-settings.inc \panels_edit_layout_settings_form()

Form definition for the display layout settings editor.

See also

panels_edit_layout_settings_form_validate()

panels_edit_layout_settings_form_submit()

1 string reference to 'panels_edit_layout_settings_form'
_panels_edit_layout_settings in includes/display_edit.inc
Handle calling and processing of the form for editing display layout settings.

File

includes/display_edit.inc, line 492

Code

function panels_edit_layout_settings_form($display, $finish, $destination, $title) {
  $layout = panels_get_layout($display->layout);
  $form = array();
  if (!empty($layout['settings form']) && function_exists($layout['settings form'])) {

    // TODO doc the ability to do this as part of the API
    $form['layout_settings'] = $layout['settings form']($display, $layout, $display->layout_settings);
    $form['layout_settings']['#tree'] = TRUE;
  }
  if ($title) {
    $form['display_title'] = array(
      '#type' => 'fieldset',
      '#title' => t('Panel Title'),
      '#tree' => TRUE,
    );
    $form['display_title']['title'] = array(
      '#type' => 'textfield',
      '#size' => 35,
      '#default_value' => $display->title,
      '#title' => t('Title'),
      '#description' => t('The title of this panel. Your theme will render this text as the main page title when a user views this panel. Note that there are some circumstances in which this title can be overridden elsewhere.'),
    );
    $form['display_title']['hide_title'] = array(
      '#type' => 'checkbox',
      '#title' => t('Hide Title?'),
      '#default_value' => $display->hide_title,
      '#description' => t('Check this box to hide the main page title for this panel.'),
    );
    if (is_string($title)) {
      $form['display_title']['title']['#description'] .= t(" If you leave this field blank, then the default title, '@title', will be used instead.", array(
        '@title' => $title,
      ));
    }
  }
  $form += panels_panel_settings($display);
  $form['variables'] = array(
    '#type' => 'value',
    '#value' => array(
      $display,
      $finish,
      $destination,
      $title,
    ),
  );
  if (empty($destination)) {
    $form['#redirect'] = FALSE;
  }
  $form['layout'] = array(
    '#type' => 'value',
    '#value' => $layout,
  );

  // Always show a Save button even if they sent in a Next or something similar
  // button.
  if ($finish !== t('Save')) {
    $form['save'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => $finish,
  );
  return $form;
}