Show CCKTSSU field name instead of vocabulary name in node view page
| Project: | CCK Taxonomy Super Select Ultra |
| Version: | 5.x-1.1 |
| Component: | User interface |
| Category: | support request |
| Priority: | critical |
| Assigned: | ali27 |
| Status: | reviewed & tested by the community |
Hello there, and thanks again for the great module. It time for feedbacks now!
Meanwhile the node view page show the correct field title, the CCK Taxonomy SSU fields labels on node add/edit pages show the vocabulary title instead of field title set previously.
My case:
- I have a vocabulary called "Dancers at creation time". I use these taxonomy terms on a "choreography" nodetype, which therefore shows the name of the dancers who where the first to learn and dance the choreography.
- I have a CCK Taxonomy SSU fields called "dancers". I use it on "document" nodetypes (images, videos) which must show the name of the dancers represented in those documents, under a single "Dancers" label.
For consistency and ease of use, I need to keep all the dancers names in a single vocabulary. But they differ from the creation time (shown in the choreography nodetype) to the most recent representation of the show (shown in the document nodetypes).
Therefore it would be useful (and more consistent as well) if the CCK Taxonomy SSU fields labels on the node add/edit page showed the real CCK taxonomy ssu field titles instead of the vocabulary title. Maybe this could be set as an otpion, but in this case I believe it should be the default one.
What do you think?
Greetings, Arsène

#1
The issue gets critical. There's no way for my editors to make the difference between a category and its ccktssu subsets in the same node add/edit page.
In a node, I need to differenciate terms and different (ccktssu) fields taking their values from the same vocabs but which are not adding the terms to the node (otherwise I'd get this "duplicate entry" error). But they still all appear to my editors under the name of the vocab... The label of the corresponding ccktssu fields should be used instead, the way they are on the node view page.
I tried to see within the module's code and comparing to the cck_taxonomy.module but I couldn't find what's in cause for doing this display correctly. Would it be somewhere in the form_alter function? I'm not sure.
#2
I just wanted to let you know that I verified this, but won't be able to get to it any time soon. The design of this module did not anticipate using the same vocabulary multiple times on the same content type.
#3
We're trying to find where the vocabulary name is displayed within the module. We found this:
From Line 272 to 292 of cck_taxonomy_ssu.module:
/*** Implementation of hook_widget_info().
*
* @return
* An array keyed by widget name. Each element of the array is an associative
* array with these keys and values:
* - "label": The human-readable label for the widget.
* - "field types": An array of field type names that can be edited using
* this widget.
*/
function cck_taxonomy_ssu_widget_info() {
$vocabularies = taxonomy_get_vocabularies();
$vocabs = array();
foreach ($vocabularies as $vid => $vocab) {
$vocabs['cck_taxonomy_ssu_' .$vocab->vid] = array(
'label' => $vocab->name,
'field types' => array('cck_taxonomy_ssu'),
);
}
return $vocabs;
} // function cck_taxonomy_ssu_widget_info()
Is this the correct place for the change?
You can browse the whole module's code here:
#4
I've patched the module. It works on our site. Please check the code to tell us if it's secure and drupal code compliant enough.
You'll see the code added between the commented lines 375 to 379 (
// dev-label-080409), under thefunction cck_taxonomy_ssu_widget($op, &$node, $field, &$items) {of* Implementation of hook_widget().:case 'form':
$vid = substr($field['widget']['type'], CCK_FIELD_NAME_LENGTH);
$tss = $field['parents'];// boolean of whether to make the parent categories check-able, or just leaf children
$vocabulary = taxonomy_get_vocabulary($vid);
$input = $vocabulary->multiple ? 'checkbox' : 'radio';
// Get root terms for vocabulary only
$terms = taxonomy_get_tree($vid, 0, -1, 1);
$form[$field['field_name']]['#tree'] = TRUE;
$vocabulary->collapsed = 1;
// dev-label-080409 : affichage de label "field_name" a la place de "vocab_name"
$result = db_query("SELECT label FROM {node_field_instance} WHERE field_name = '%s'", $field['field_name']);
$row = db_fetch_object($result);
$vocabulary->name = $row->label;
// dev-label-080409 : affichage de label "field_name" a la place de "vocab_name"
$form[$field['field_name']]['tid'] = _cck_taxonomy_ssu_branch($field, $vid, $vocabulary, $vocabulary->tags);
$form[$field['field_name']]['tid']['#weight'] = $field['weight'];
$form[$field['field_name']]['tid']['#required'] = $field['required'];
_cck_taxonomy_ssu_next_nested($field, $terms, $vid, $input, $tss, $items, $form[$field['field_name']]['tid'], $vocabulary->tags);
//cache_clear_all('content:'. $node->nid .':'. $node->vid, 'cache_content');
return $form;
Thanks in advance,
#5
Assigning patch
#6
That looks right. Will be in the next release when I can get to it. I'm currently trying to chip away at og_forum's issue queue.
#7
Dear Ali27,
You're a hero, and the reason open source software has a chance of working. Good Job!
Please release this update soon, it's very useful and needed.