function pagerer_pane_form in Pagerer 7
Pane level settings form.
1 string reference to 'pagerer_pane_form'
- pagerer_menu in ./
pagerer.module - Implements hook_menu().
File
- ./
pagerer.admin.inc, line 414 - Pagerer administration
Code
function pagerer_pane_form($form, &$form_state) {
// Check if jQuery update is installed.
if (module_exists('jquery_update')) {
$js_enabled = TRUE;
}
else {
$js_enabled = FALSE;
drupal_set_message(t("To enable the jQuery elements 'widget', 'slider' and 'scrollpane' for current page, Pagerer requires the 'jQuery update' module to be installed and enabled."), 'status', FALSE);
}
// Get pagerer preset.
$preset = _pagerer_get_preset($form_state['build_info']['args'][0]);
// Pane to be configured.
$pane = $form_state['build_info']['args'][1];
// Merge configuration variables with those coming from default theme
// variables.
$theme = $preset[$pane . '_pane']['theme_name'];
if (isset($preset[$pane . '_pane']['theme_variables'])) {
$theme_vars = $preset[$pane . '_pane']['theme_variables'];
}
else {
$theme_vars = array();
}
$theme_registry = theme_get_registry();
$default_theme_vars = $theme_registry[$theme]['variables'];
$v = array_merge($default_theme_vars, $theme_vars);
// Pane theme.
switch ($pane) {
case 'left':
$pane_title = t("Left pane theme");
break;
case 'center':
$pane_title = t("Center pane theme");
break;
case 'right':
$pane_title = t("Right pane theme");
break;
}
$form['theme_name'] = array(
'#type' => 'textfield',
'#title' => check_plain($pane_title),
'#default_value' => $theme,
'#description' => t("To change the pane theme, go back to the 'Edit preset' form."),
'#disabled' => TRUE,
);
$options = drupal_map_assoc(array(
'pages',
'items',
'item_ranges',
));
$form['display'] = array(
'#type' => 'select',
'#title' => t("Display"),
'#options' => $options,
'#default_value' => $v['display'],
'#description' => t("Select whether to display pages, or items, or item ranges."),
'#required' => TRUE,
);
$form['quantity'] = array(
'#type' => 'textfield',
'#title' => t("Quantity"),
'#default_value' => $v['quantity'],
'#description' => t("The number of pages in the pager list."),
'#required' => TRUE,
'#size' => 3,
'#maxlength' => 3,
);
if ($theme == 'pagerer_progressive') {
$form['factors'] = array(
'#type' => 'textfield',
'#title' => t("Scale factors"),
'#default_value' => $v['factors'],
'#description' => t("Comma delimited string of factors to use to determine progressive links."),
'#required' => TRUE,
);
}
// Display configuration.
$form['display_container'] = array(
'#type' => 'fieldset',
'#title' => t("Main options"),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$options = drupal_map_assoc(array(
'none',
'before_current',
'first',
'last',
));
$form['display_container']['label_display'] = array(
'#type' => 'select',
'#title' => t("Label"),
'#options' => $options,
'#default_value' => $v['label_display'],
'#description' => t("Select whether and where to render a text 'label' element (e.g. 'Page'). Options are 'none' (not displayed), 'before_current' (in front of current page), 'first' (at the beginning), 'last' (at the end)."),
'#required' => TRUE,
);
$options = array(
'none',
'normal',
);
// Widget, Slider and Scrollpane are only available with jQuery update
// installed.
if ($js_enabled) {
$options = array_merge($options, array(
'widget',
'slider',
'scrollpane',
));
}
$options = drupal_map_assoc($options);
$form['display_container']['current_display'] = array(
'#type' => 'select',
'#title' => t("Current page"),
'#options' => $options,
'#default_value' => $v['current_display'],
'#description' => t("Select how the current page is rendered in the pager. Options are 'none' (not displayed), 'normal' (as a text), 'widget' (an active input box for users to enter directly a page to go to), 'slider' (as a slider), 'scrollpane' (as a scrolling pane embedding a full pager)."),
'#required' => TRUE,
);
$options = drupal_map_assoc(array(
'none',
'after_current',
'first',
'last',
));
$form['display_container']['total_display'] = array(
'#type' => 'select',
'#title' => t("Total pages/items"),
'#options' => $options,
'#default_value' => $v['total_display'],
'#description' => t("Select whether and where to render a text element indicating the total pages (or items). Options are 'none' (not displayed), 'after_current' (just after current page), 'first' (at the beginning), 'last' (at the end)."),
'#required' => TRUE,
);
$options = array(
'default' => t('Display pager only if there are at least two pages of results (default).'),
'one_above' => t('Display pager also if there is only one page of results.'),
'none' => t('Display pager also if the result set is empty.'),
);
$form['display_container']['display_restriction'] = array(
'#type' => 'radios',
'#title' => t("Restriction"),
'#options' => $options,
'#default_value' => $v['display_restriction'],
'#required' => TRUE,
);
// Links configuration.
$form['links_container'] = array(
'#type' => 'fieldset',
'#title' => t("Links"),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t("Configure link elements like '<< first', '< previous', 'next >' and 'last >>'."),
);
$options = drupal_map_assoc(array(
'never',
'not_on_first',
'always',
));
$form['links_container']['first_link'] = array(
'#type' => 'select',
'#title' => t("First"),
'#options' => $options,
'#default_value' => $v['first_link'],
'#description' => t("Select when to render a link to the first page (e.g. '<< first'). Options are 'never' (not displayed), 'not_on_first' (not displayed if current page is the first), 'always' (always displayed)."),
'#required' => TRUE,
);
$options = drupal_map_assoc(array(
'never',
'not_on_first',
'always',
));
$form['links_container']['previous_link'] = array(
'#type' => 'select',
'#title' => t("Previous"),
'#options' => $options,
'#default_value' => $v['previous_link'],
'#description' => t("Select when to render a link to the previous page (e.g. '<< previous'). Options are 'never' (not displayed), 'not_on_first' (not displayed if current page is the first), 'always' (always displayed)."),
'#required' => TRUE,
);
$options = drupal_map_assoc(array(
'never',
'not_on_last',
'always',
));
$form['links_container']['next_link'] = array(
'#type' => 'select',
'#title' => t("Next"),
'#options' => $options,
'#default_value' => $v['next_link'],
'#description' => t("Select when to render a link to the next page (e.g. 'next >'). Options are 'never' (not displayed), 'not_on_last' (not displayed if current page is the last), 'always' (always displayed)."),
'#required' => TRUE,
);
$options = drupal_map_assoc(array(
'never',
'not_on_last',
'always',
));
$form['links_container']['last_link'] = array(
'#type' => 'select',
'#title' => t("Last"),
'#options' => $options,
'#default_value' => $v['last_link'],
'#description' => t("Select when to render a link to the last page (e.g. 'last >>'). Options are 'never' (not displayed), 'not_on_last' (not displayed if current page is the last), 'always' (always displayed)."),
'#required' => TRUE,
);
if ($theme == 'pagerer_adaptive' or $theme == 'pagerer_progressive') {
$options = drupal_map_assoc(array(
'relative',
'absolute',
));
$form['links_container']['progr_links'] = array(
'#type' => 'select',
'#title' => t("Outer pages"),
'#options' => $options,
'#default_value' => $v['progr_links'],
'#description' => t("Progressive and Adaptive pagers render links to pages far from the current. Select whether to render these links as 'absolute' page numbers (or items/item ranges) or as 'relative' offsets from current (e.g. +10 +100 +1000)."),
'#required' => TRUE,
);
}
// Separators configuration.
$form['separators_container'] = array(
'#type' => 'fieldset',
'#title' => t("Separators"),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t("Configure separators text."),
);
$form['separators_container']['pager_breaker'] = array(
'#type' => 'textfield',
'#title' => t("Breaker"),
'#default_value' => $v['pager_breaker'],
'#description' => t("Text to render a break in the page sequence."),
);
$form['separators_container']['pager_separator'] = array(
'#type' => 'textfield',
'#title' => t("Element separator"),
'#default_value' => $v['pager_separator'],
'#description' => t("Text to fill between contiguous pages. 'none' will prevent creating any filler."),
);
$form['separators_container']['range_separator'] = array(
'#type' => 'textfield',
'#title' => t("Range separator"),
'#default_value' => $v['range_separator'],
'#description' => t("Text to place between first and last item in a range."),
);
// Advanced options configuration.
$form['advanced_options_container'] = array(
'#type' => 'fieldset',
'#title' => t("Advanced options"),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t("Configure advanced options."),
);
$form['advanced_options_container']['widget'] = array(
'#type' => 'fieldset',
'#title' => t("Widget"),
'#collapsible' => FALSE,
'#description' => t("jQuery widget options."),
);
$form['advanced_options_container']['widget']['widget_resize'] = array(
'#type' => 'checkbox',
'#title' => t("Automatic width adjustment"),
'#default_value' => $v['widget_resize'],
'#description' => t("If set, the widget's width will be adjusted dynamically based on the total number of pages/items. When unset, style width will prevail."),
);
$form['advanced_options_container']['slider'] = array(
'#type' => 'fieldset',
'#title' => t("Slider"),
'#collapsible' => FALSE,
'#description' => t("jQuery slider options."),
);
$options = drupal_map_assoc(array(
'tickmark',
'timelapse',
'auto',
));
$form['advanced_options_container']['slider']['slider_action'] = array(
'#type' => 'select',
'#title' => t("Action confirmation method"),
'#options' => $options,
'#default_value' => $v['slider_action'],
'#description' => t("Select how the page relocation should be triggered after it has been selected through the slider. Options are: 'tickmark' (page relocation only occurs after user clicks a tickmark on the slider handle), 'timelapse' (page relocation occurs after a grace time has elapsed), 'auto' (the timelapse method is automatically selected based on the accuracy of the slider)."),
'#required' => TRUE,
);
$form['advanced_options_container']['slider']['slider_action_timelapse'] = array(
'#type' => 'textfield',
'#title' => t("Confirmation timelapse"),
'#default_value' => $v['slider_action_timelapse'],
'#description' => t("The grace time (in milliseconds) to wait before the page is relocated, in case 'timelapse' confirmation method is selected. '0' will trigger relocation immediately."),
'#size' => 5,
'#maxlength' => 5,
'#required' => TRUE,
);
$options = drupal_map_assoc(array(
'yes',
'no',
'auto',
));
$form['advanced_options_container']['slider']['slider_navigation_icons'] = array(
'#type' => 'select',
'#title' => t("Display navigation icons"),
'#options' => $options,
'#default_value' => $v['slider_navigation_icons'],
'#description' => t("Select whether to display +/- navigation icons on the sides of the slider. Options are 'yes', 'no', 'auto' (the icons are automatically displayed based on the accuracy of the slider)."),
'#required' => TRUE,
);
// Save configuration.
$form['save'] = array(
'#type' => 'submit',
'#name' => 'save',
'#value' => t("Save pane"),
);
return $form;
}