function select_with_style_field_widget_info in Select with Style 7
Implements hook_field_widget_info().
Defines two new select widgets, both allowing for CSS attributes to be added to the options so that they may be styled. The 'select_tree' widget is similar in appearance to 'select_optgroups', however the parent headings are selectable, not just labels.
File
- select_with_style/
select_with_style.module, line 34 - select_with_style.module
Code
function select_with_style_field_widget_info() {
// @todo dynamically build list types, including contrib modules
$list_types = array(
'list_text',
'list_integer',
'list_float',
);
// Don't support list types until we can do hierarchies in lists.
$enabled_field_types = array(
'taxonomy_term_reference',
);
$common = array(
'field types' => $enabled_field_types,
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_CUSTOM,
),
'settings' => array(
'select_with_style' => array(
'hierarchy_depth_prefix' => variable_get('select_with_style_def_hierarchy_depth_prefix', '-'),
'term_transform_callback' => variable_get('select_with_style_def_term_transform_callback'),
'multi_select_height' => variable_get('select_with_style_def_multi_select_height'),
'css file' => variable_get('select_with_style_def_css_file', array()),
),
),
);
// We could probably have just one widget and a config parameter (tickbox)
// in select_with_style_field_widget_settings_form() to distinguish between
// the two... However, from a UI perspective two seperate options is clearer.
$widget_info = array(
'select_optgroups' => $common + array(
'label' => t('Select list, styled optgroups'),
),
'select_tree' => $common + array(
'label' => t('Select list, styled tree'),
),
);
return $widget_info;
}