function select_with_style_field_widget_settings_form in Select with Style 7
Implements hook_field_widget_settings_form().
File
- select_with_style/
select_with_style.module, line 122 - select_with_style.module
Code
function select_with_style_field_widget_settings_form($field, $instance) {
$settings = $instance['widget']['settings']['select_with_style'];
$form['select_with_style'] = array(
'#type' => 'fieldset',
'#title' => 'Select list options',
'#collapsible' => TRUE,
);
$form['select_with_style']['hierarchy_depth_prefix'] = array(
'#type' => 'textfield',
'#size' => 12,
'#title' => t('Hierarchy depth indicator prefix for child options'),
'#description' => t("This particularly applies to taxonomy term select lists. Core default is a single hyphen. You may type any sequence of characters. Copy and paste from these if you like them: <strong>► ⇒ » ↘ ◆ ❤ ❥ ❖ ✈ ♫ ♛ ♟ ★ ✱ ☺ ✔ ☯ ✉ </strong>.<br/>Blank out the field if you don't want a prefix."),
'#default_value' => $settings['hierarchy_depth_prefix'],
'#element_validate' => array(
'_select_with_style_validate_hierarchy_depth_prefix',
),
'#required' => FALSE,
);
$form['select_with_style']['term_transform_callback'] = array(
'#type' => 'textfield',
'#size' => 60,
'#title' => t('Optionally invoke a callback to apply a transformation of option labels into CSS class names'),
'#description' => t('Enter <code>select_with_style_country_name_to_code</code> to transform localised country names into ISO two-letter codes.'),
'#default_value' => $settings['term_transform_callback'],
'#element_validate' => array(
'_select_with_style_validate_callback',
),
'#required' => FALSE,
);
$form['select_with_style']['multi_select_height'] = array(
'#type' => 'textfield',
'#size' => 4,
'#title' => t('Height of select box (in rows)'),
'#description' => t('Applies only when <strong>Number of values</strong> (below) is greater than 1. If left blank the browser default (usually 4) will be used.'),
'#default_value' => $settings['multi_select_height'],
'#element_validate' => array(
'element_validate_integer_positive',
),
'#required' => FALSE,
);
$options = array();
foreach (select_with_style_css_files() as $name => $filespec) {
$options[$name] = $name;
}
$form['select_with_style']['css file'] = array(
'#type' => 'select',
'#multiple' => TRUE,
'#size' => 3,
// may not be honored
'#title' => t('Styling file(s)'),
'#default_value' => empty($settings['css file']) ? array() : is_array($settings['css file']) ? $settings['css file'] : array(
$settings['css file'],
),
'#options' => $options,
'#description' => t('The directory where the above files are looked up may be changed on the Select with Style <a href="@href">configuraton page</a>.', array(
'@href' => url('admin/config/system/select_with_style'),
)),
'#required' => FALSE,
);
return $form;
}