You are here

function panelizer_settings_form in Panelizer 7.3

Same name and namespace in other branches
  1. 6 includes/common.inc \panelizer_settings_form()
  2. 7 includes/common.inc \panelizer_settings_form()
  3. 7.2 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,
    );
  }

  // We only allow this setting on the "full page override" because it
  // does not make sense in other modes.
  if ($form_state['view_mode'] == 'page_manager') {
    $form['no_blocks'] = array(
      '#type' => 'checkbox',
      '#default_value' => $panelizer->no_blocks,
      '#title' => t('Disable Drupal blocks/regions'),
      '#description' => t("Check this to have the display not show the theme's sidebars. 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,
    );
  }
  if ($form_state['view_mode'] != 'page_manager') {
    $form['title_element'] = array(
      '#type' => 'textfield',
      '#default_value' => $panelizer->title_element,
      '#title' => t('Title element'),
      '#description' => t('The HTML element to use for the entity title. Typically this will be an H2.'),
    );
    $form['link_to_entity'] = array(
      '#type' => 'checkbox',
      '#default_value' => $panelizer->link_to_entity,
      '#title' => t('Link title to entity'),
      '#description' => t('If checked the title will be a link to the entity.'),
    );
    $form['css_class'] = array(
      '#type' => 'textfield',
      '#size' => 35,
      '#maxlength' => 255,
      '#default_value' => $panelizer->css_class,
      '#title' => t('CSS class'),
      '#description' => t('The CSS class to apply to this display. You may use context substitions here.'),
    );
  }
  else {
    $form['css_class'] = array(
      '#type' => 'textfield',
      '#size' => 35,
      '#maxlength' => 255,
      '#default_value' => $panelizer->css_class,
      '#title' => t('Body class'),
      '#description' => t('The CSS class to apply to the BODY tag. You may use context substitions here.'),
    );
  }
  $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 display.'),
  );
  $form['css'] = array(
    '#type' => 'textarea',
    '#title' => t('CSS code'),
    '#description' => t('Enter well-formed CSS code here; this code will be embedded into the display and should only be used for minor adjustments; it is usually better to try to put CSS for this display 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'),
  );
  return $form;
}