You are here

function panels_mini_edit_form in Panels 6.2

Same name and namespace in other branches
  1. 5.2 panels_mini/panels_mini.module \panels_mini_edit_form()

Form to edit the settings of a mini panel.

3 string references to 'panels_mini_edit_form'
panels_mini_edit in panels_mini/panels_mini.admin.inc
Edit a mini panel.
panels_mini_import_form_submit in panels_mini/panels_mini.admin.inc
Handle the submit button on importing a mini panel.
panels_mini_import_mini in panels_mini/panels_mini.admin.inc
Page callback to import a mini panel from PHP code.

File

panels_mini/panels_mini.admin.inc, line 396
Administrative items for the panels mini module.

Code

function panels_mini_edit_form(&$form_state, $panel_mini) {
  panels_load_include('common');
  drupal_add_css(panels_get_path('css/panels_admin.css'));
  $form['pid'] = array(
    '#type' => 'value',
    '#value' => $panel_mini->pid,
  );
  $form['panel_mini'] = array(
    '#type' => 'value',
    '#value' => $panel_mini,
  );
  $form['right'] = array(
    '#prefix' => '<div class="layout-container">',
    '#suffix' => '</div>',
  );
  $form['left'] = array(
    '#prefix' => '<div class="info-container">',
    '#suffix' => '</div>',
  );
  $form['left']['settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Settings'),
  );
  $form['left']['settings']['title'] = array(
    '#type' => 'textfield',
    '#size' => 24,
    '#default_value' => $panel_mini->title,
    '#title' => t('Mini panel title'),
    '#description' => t('The title for this mini panel. It can be overridden in the block configuration.'),
  );
  $form['left']['settings']['name'] = array(
    '#type' => 'textfield',
    '#size' => 24,
    '#default_value' => $panel_mini->name,
    '#title' => t('Mini panel name'),
    '#description' => t('A unique name used to identify this panel page internally. It must be only be alpha characters and underscores. No spaces, numbers or uppercase characters.'),
  );
  $form['left']['settings']['category'] = array(
    '#type' => 'textfield',
    '#size' => 24,
    '#default_value' => $panel_mini->category,
    '#title' => t('Mini panel category'),
    '#description' => t("The category that this mini-panel will be grouped into on the Add Content form. Only upper and lower-case alphanumeric characters are allowed. If left blank, defaults to 'Mini panels'."),
  );
  panels_load_include('plugins');
  $panel_mini->context = $panel_mini->display->context = panels_context_load_contexts($panel_mini);
  $form['right']['layout'] = array(
    '#type' => 'fieldset',
    '#title' => t('Layout'),
  );
  $layout = panels_get_layout($panel_mini->display->layout);
  $form['right']['layout']['layout-icon'] = array(
    '#value' => panels_print_layout_icon($panel_mini->display->layout, $layout),
  );
  $form['right']['layout']['layout-display'] = array(
    '#value' => check_plain($layout['title']),
  );
  $form['right']['layout']['layout-content'] = array(
    '#value' => theme('panels_common_content_list', $panel_mini->display),
  );
  $contexts = theme('panels_common_context_list', $panel_mini);
  if ($contexts) {
    $form['right']['context'] = array(
      '#type' => 'fieldset',
      '#title' => t('Contexts'),
    );
    $form['right']['context']['context'] = array(
      '#value' => $contexts,
    );
  }
  $label = $panel_mini->pid == 'new' ? t('Save and proceed') : t('Save');
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => $label,
  );
  return $form;
}