function weight_plugin_style::options_form in Weight 6
File
- views/weight_plugin_style.inc, line 7
- Sort handler for Weight module.
Class
- weight_plugin_style
- @file
Sort handler for Weight module.
Code
function options_form(&$form, &$form_state) {
$handlers = $this->display->handler
->get_handlers('field');
if (empty($handlers)) {
$form['error_markup'] = array(
'#value' => t('You need at least one field before you can configure your table settings'),
'#prefix' => '<div class="error form-item description">',
'#suffix' => '</div>',
);
return;
}
$form['override'] = array(
'#type' => 'checkbox',
'#title' => t('Override normal sorting if click sorting is used'),
'#default_value' => !empty($this->options['override']),
);
$form['sticky'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Drupal style "sticky" table headers (Javascript)'),
'#default_value' => !empty($this->options['sticky']),
'#description' => t('(Sticky header effects will not be active for preview below, only on live output.)'),
);
$form['summary'] = array(
'#type' => 'textfield',
'#title' => t('Table summary'),
'#description' => t('This value will be displayed as table-summary attribute in the html. Set this for better accessiblity of your site.'),
'#default_value' => $this->options['summary'],
);
$form['#theme'] = 'weight_ui_style_plugin';
$columns = $this
->sanitize_columns($this->options['columns']);
$field_names = $this->display->handler
->get_field_labels();
if (isset($this->options['default'])) {
$default = $this->options['default'];
if (!isset($columns[$default])) {
$default = -1;
}
}
else {
$default = -1;
}
foreach ($columns as $field => $column) {
$safe = str_replace(array(
'][',
'_',
' ',
), '-', $field);
$id = 'edit-style-options-columns-' . $safe;
$form['columns'][$field] = array(
'#type' => 'select',
'#options' => $field_names,
'#default_value' => $column,
);
$form['info'][$field]['separator'] = array(
'#type' => 'textfield',
'#size' => 10,
'#default_value' => isset($this->options['info'][$field]['separator']) ? $this->options['info'][$field]['separator'] : '',
'#process' => array(
'views_process_dependency',
),
'#dependency' => array(
$id => array(
$field,
),
),
);
$form['info'][$field]['name'] = array(
'#value' => $field_names[$field],
);
}
$form['description_markup'] = array(
'#prefix' => '<div class="description form-item">',
'#suffix' => '</div>',
'#value' => t('Place fields into columns; you may combine multiple fields into the same column. If you do, the separator in the column specified will be used to separate the fields. Check the sortable box to make that column click sortable, and check the default sort radio to determine which column will be sorted by default, if any. You may control column order and field labels in the fields section.'),
);
}