You are here

function panelizer_settings_form in Panelizer 7.2

Same name and namespace in other branches
  1. 6 includes/common.inc \panelizer_settings_form()
  2. 7.3 includes/common.inc \panelizer_settings_form()
  3. 7 includes/common.inc \panelizer_settings_form()

Form to configure basic panelizer settings.

2 string references to 'panelizer_settings_form'
PanelizerEntityDefault::page_settings in plugins/entity/PanelizerEntityDefault.class.php
Switched page callback to give the settings form.
panelizer_default_settings_page in includes/admin.inc
Page to configure basic settings for a panelizer default.

File

includes/common.inc, line 13
Contains common forms and routines that different object types use.

Code

function panelizer_settings_form($form, &$form_state) {
  $panelizer = $form_state['panelizer'];
  if (!empty($form_state['has title'])) {
    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => t('Administrative title'),
      '#description' => t('This will appear in the administrative interface to easily identify it.'),
      '#default_value' => $panelizer->title,
    );
  }
  $form['no_blocks'] = array(
    '#type' => 'checkbox',
    '#default_value' => $panelizer->no_blocks,
    '#title' => t('Disable Drupal blocks/regions'),
    '#description' => t('Check this to have the panel disable sidebars displayed in the theme. Note that some themes support this setting better than others. If in doubt, try with stock themes to see.'),
  );
  ctools_include('plugins', 'panels');
  $pipelines = panels_get_renderer_pipelines();

  // If there are no pipelines, that probably means we're operating in
  // legacy mode.
  if (empty($pipelines)) {

    // We retain the original pipeline so we don't wreck things by installing
    // old modules.
    $form['pipeline'] = array(
      '#type' => 'value',
      '#value' => $panelizer->pipeline,
    );
  }
  else {
    $options = array();
    foreach ($pipelines as $name => $pipeline) {
      $options[$name] = check_plain($pipeline->admin_title) . '<div class="description">' . check_plain($pipeline->admin_description) . '</div>';
    }
    $form['pipeline'] = array(
      '#type' => 'radios',
      '#options' => $options,
      '#title' => t('Renderer'),
      '#default_value' => $panelizer->pipeline,
    );
  }
  $form['css_id'] = array(
    '#type' => 'textfield',
    '#size' => 35,
    '#default_value' => $panelizer->css_id,
    '#title' => t('CSS ID'),
    '#description' => t('The CSS ID to apply to this panel'),
  );
  $form['css'] = array(
    '#type' => 'textarea',
    '#title' => t('CSS code'),
    '#description' => t('Enter well-formed CSS code here; this code will be embedded into the panel, and should only be used for minor adjustments; it is usually better to try to put CSS for the panel into the theme if possible. This CSS will be filtered for safety so some CSS may not work.'),
    '#default_value' => $panelizer->css,
  );
  panelizer_add_revision_info_form($form, $form_state);
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  if (!empty($form_state['reset button'])) {
    $form['actions']['reset'] = array(
      '#type' => 'submit',
      '#value' => t('Reset to default'),
      '#reset' => TRUE,
    );
  }
  return $form;
}