This issue comes from a discussion on the multiselect module: #446052: Display should reflect the taxonomy hierarchy.
Currently, Content Taxonomy implements its option for rendering term indentations in select lists with content_taxonomy_options_widget_settings(), thus:
$form['settings']['show_depth'] = array(
'#type' => 'checkbox',
'#title' => t('Indent child terms with \' - \' signs'),
'#default_value' => is_numeric($widget['show_depth']) ? $widget['show_depth'] : 1,
'#description' => t('If this option is checked, a hierarchy gets visualized by indenting child terms, otherwise it\'s a flat list'),
);
Unfortunately, since this is added with hook_widget_settings() and not hook_field_settings(), this option is not available when using a custom widget (like that of the multiselect module).
Now, if I simply implement hook_widget_settings() in the second module with a clone of content_taxonomy_options_widget_settings(), the hierarchy does get rendered with the proper indentations, without adding any other code. However, that results in the settings fieldset appearing on the configuration form of every field that uses the second module's widget, not just content taxonomy fields. Unfortunately, hook_widget_settings() doesn't get any information about the field, so I have no way of restricting it to content taxonomy fields only. And, really, the indentation is related to the field type, not the widget, since it's specific to taxonomy fields.
Unlike hook_widget_settings(), hook_field_settings() gets information about both the field and the widget. So, it seems to me that it would be better for Content Taxonomy to add the indentation option in that hook, conditionally based on widget type (since it's only valid for select-style widgets) and then custom widgets could add themselves to the list of widgets that can use the indentation option (maybe with hook_field_settings_alter()). What do you think?
Comments
Comment #1
xjmComment #2
xjmSee also #736524: Content Specific Settings When Re-using CCK Content Taxonomy Field.
Comment #3
3dloco commented+1
Comment #4
odegard commentedI think I just ran into this problem. I'm using multiselect but children were not indented.
I switched to radiobuttons, saw that the "indent children with -" option was indeed selected, but I saved the form anyway on a hunch, then changed the widget back to multiselect, saved, and now the children were indented!