function panels_edit_display_settings_form in Panels 6.3
Same name and namespace in other branches
- 7.3 includes/display-edit.inc \panels_edit_display_settings_form()
Form for display settings.
1 call to panels_edit_display_settings_form()
- panels_edit_display_form in includes/
display-edit.inc - Form definition for the panels display editor
File
- includes/
display-edit.inc, line 198
Code
function panels_edit_display_settings_form(&$form_state) {
$form = array();
$display =& $form_state['display'];
$layout = panels_get_layout($display->layout);
$form_state['layout'] = $layout;
ctools_include('dependent');
if ($form_state['display_title']) {
$form['display_title'] = array(
'#tree' => TRUE,
);
$form['display_title']['hide_title'] = array(
'#type' => 'select',
'#title' => t('Title type'),
'#default_value' => (int) $display->hide_title,
'#options' => array(
PANELS_TITLE_NONE => t('No title'),
PANELS_TITLE_FIXED => t('Manually set'),
PANELS_TITLE_PANE => t('From pane'),
),
);
$form['display_title']['title'] = array(
'#type' => 'textfield',
'#default_value' => $display->title,
'#title' => t('Title'),
'#description' => t('The title of this panel. If left blank, a default title may be used. If you want the title actually to be blank, change the "Title type" dropdown from "Manually Set" to "No Title".'),
'#process' => array(
'ctools_dependent_process',
),
'#dependency' => array(
'edit-display-title-hide-title' => array(
PANELS_TITLE_FIXED,
),
),
);
if (!empty($display->context)) {
$form['display_title']['title']['#description'] .= ' ' . t('You may use substitutions in this title.');
// We have to create a manual fieldset because fieldsets do not support IDs.
// Use 'hidden' instead of 'markup' so that the process will run.
// Add js for collapsible fieldsets manually
drupal_add_js('misc/collapse.js');
$form['display_title']['contexts_prefix'] = array(
'#type' => 'hidden',
'#id' => 'edit-display-substitutions',
'#prefix' => '<div><fieldset id="edit-display-substitutions" class="collapsed collapsible"><legend>' . t('Substitutions') . '</legend>',
'#process' => array(
'ctools_dependent_process',
),
'#dependency' => array(
'edit-display-title-hide-title' => array(
PANELS_TITLE_FIXED,
),
),
);
$rows = array();
foreach ($display->context as $context) {
foreach (ctools_context_get_converters('%' . check_plain($context->keyword) . ':', $context) as $keyword => $title) {
$rows[] = array(
check_plain($keyword),
t('@identifier: @title', array(
'@title' => $title,
'@identifier' => $context->identifier,
)),
);
}
}
$header = array(
t('Keyword'),
t('Value'),
);
$form['display_title']['contexts'] = array(
'#value' => theme('table', $header, $rows),
);
$form['display_title']['contexts_suffix'] = array(
'#value' => '</fieldset></div>',
);
}
}
// TODO doc the ability to do this as part of the API
if (!empty($layout['settings form']) && function_exists($layout['settings form'])) {
$form['layout_settings'] = $layout['settings form']($display, $layout, $display->layout_settings);
}
$form['layout_settings']['#tree'] = TRUE;
return $form;
}