You are here

function panels_ct_conf_form in Panels 6.2

Same name and namespace in other branches
  1. 5.2 includes/plugins.inc \panels_ct_conf_form()

Add the default FAPI elements to the content type configuration form

Related topics

1 call to panels_ct_conf_form()
panels_content_config_form in includes/display-edit.inc
Master FAPI definition for all pane add/edit configuration forms.

File

includes/plugins.inc, line 263
plugins.inc

Code

function panels_ct_conf_form($content_type, $subtype, $contexts, $conf) {
  if (!empty($subtype['required context']) && is_array($contexts)) {
    $form['context'] = panels_context_selector($contexts, $subtype['required context'], isset($conf['context']) ? $conf['context'] : array());
  }
  $style_options = array(
    'default' => t('Default'),
  );
  foreach (panels_get_styles() as $name => $properties) {
    if (empty($properties['hidden']) && !empty($properties['render pane'])) {
      $style_options[$name] = $properties['title'];
    }
  }
  asort($style_options);
  if (empty($conf['style'])) {
    $conf['style'] = 'default';
  }
  if ($style_options) {
    $form['style'] = array(
      '#type' => 'select',
      '#title' => t('Pane style'),
      '#default_value' => $conf['style'],
      '#options' => $style_options,
    );
  }

  // Unless we're not allowed to overide the title on this content type, add this
  // gadget to all panes.
  if (empty($content_type['no title override'])) {
    $form['aligner_start'] = array(
      '#value' => '<div class="option-text-aligner">',
    );
    $form['override_title'] = array(
      '#type' => 'checkbox',
      '#default_value' => isset($conf['override_title']) ? $conf['override_title'] : '',
      '#title' => t('Override title'),
      '#id' => 'override-title-checkbox',
    );
    $form['override_title_text'] = array(
      '#type' => 'textfield',
      '#default_value' => isset($conf['override_title_text']) ? $conf['override_title_text'] : '',
      '#size' => 35,
      '#id' => 'override-title-textfield',
    );
    $form['aligner_stop'] = array(
      '#value' => '</div><div style="clear: both; padding: 0; margin: 0"></div>',
    );
    $form['override_title_markup'] = array(
      '#prefix' => '<div class="description">',
      '#suffix' => '</div>',
      '#value' => t('You may use %keywords from contexts, as well as %title to contain the original title.'),
    );
  }

  // Add CSS class and ID gadgets to all panes if advanced pane settings is set.
  if (user_access('administer advanced pane settings')) {
    $form['css_id'] = array(
      '#type' => 'textfield',
      '#default_value' => isset($conf['css_id']) ? $conf['css_id'] : '',
      '#title' => t('CSS ID'),
      '#description' => t('CSS ID to apply to this content. This may be blank.'),
      '#weight' => 2,
      '#size' => 15,
    );
    $form['css_class'] = array(
      '#type' => 'textfield',
      '#default_value' => isset($conf['css_class']) ? $conf['css_class'] : '',
      '#title' => t('CSS class'),
      '#description' => t('CSS class to apply to this content. This may be blank.'),
      '#weight' => 2,
      '#size' => 15,
    );
  }
  return $form;
}