Label is not showing up for content_taxonomy fields

32940stf - May 19, 2008 - 14:42
Project:Hierarchical Select
Version:5.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Wim Leers
Status:closed
Description

The label for the hierarchial select element shows up as expected for the taxonomy form however it does not show up for the contet_taxonomy form with the heirarchial select widget. See attached

AttachmentSize
label.jpg3.73 KB

#1

Wim Leers - May 19, 2008 - 16:41
Category:support request» bug report
Assigned to:Anonymous» Wim Leers

That's odd. Must be a typo.

#2

Vuds - May 30, 2008 - 14:43

Got that too.

It's oddest yet because, if I go and send the form, the system saves the first one option of all levels, even if these levels didn't appear to be chosen in the form. Also, ">none<" appears in the preview, but not in the form.

Thanks!

#3

Vuds - June 4, 2008 - 18:38

Okay, I tested it more and I understood that there are 2 different things we spoke here:

1) The label for the field isn't appearing in the final node ( Home > Administer > Content management > Content types > "Your Node" > Label * ), even for editing or for show, and I couldn't make it appear;

2) The labels INSIDE the drop-down box (level labels) aren't appearing. But in this one I've got the point to work around the error and make it correct:

a) Set and remember the preferences of you choice in the HS field config inside the node (I'm using CCK - Home > Administer > Content management > Content types > "Your Node" > link "separate form to configure this widget'ssettings" );

b) Set the SAME preferences (even the drop-down labels) in the HS configuration inside "Edit Vocabulary" on Categories ( Home > Administer > Content management > Categories > "Your Vocabulary" > Edit Vocabulary ).

If you pay attention, returning to the configuration page of a), some fields that we assigned before will then be unassigned. I believe that HS system is picking (or saving) some configurations from the settings in the Vocabulary, and other from the setting in the Field.

Hope to see it corrected soon!

Thanks again, regards!

#4

Vuds - June 5, 2008 - 16:24

I've tested more yet and could accurate more yet.

For the inside drop-down list label:
In the settings for the HS Field, if I select "Force the user to choose a term from a deepest level", it doesn't bring the level label (the only one first level that I can set with this option). if the selection is "Allow the user to choose a term from any level", then it does bring the labels of all levels.

For the field label:
The field label is not working just in CCK nodes. I've tried the same field in common nodes (page, story) for categorization and the label appears on it.

But I found another bug, writing another issue.

Regards!

#5

Wim Leers - June 5, 2008 - 18:07
Status:active» active (needs more info)

1) That's by design.

2) Are you sure you didn't give an empty label in the CCK field settings?

#6

Vuds - June 5, 2008 - 18:34

1) As related in #4, when associated with page/story nodes, the label appears. But the same label doesn't appear when configured as a CCK field (with the special CCK field settings configured exactly as for the vocabulary).

2) Yes, I'm sure. I had put one level label for every level the configuration permits me (one label for "save the deepest level", n-labels as necessary for "save any level") . And the field label is mandatory.

Being more exactly yet, these errors just occur as a CCK field. I had tested it exhaustedly and in my page/story nodes with this same HS selection, they work perfectly, the field label appears, and the level labels too.

#7

32940stf - June 8, 2008 - 11:35

Guys,

I just downloaded and tried the latest build I am also seeing the same behaviour for my cck fields in all my content types.

Vuds: What work around are you referencing here

2) The labels INSIDE the drop-down box (level labels) aren't appearing. But in this one I've got the point to work around the error and make it correct:

#8

32940stf - June 8, 2008 - 12:17

Wim,

If it helps, here is the config for my cck field. It is a multi-assigned field used on several content types

Node_Field table:
a:4:{s:4:"save";s:4:"both";s:3:"vid";s:2:"17";s:3:"tid";s:1:"0";s:5:"depth";s:1:"3";}

Node_Field_Instance.Widget_settings:
a:2:{s:13:"default_value";a:1:{s:4:"tids";a:1:{i:0;s:1:"0";}}s:17:"default_value_php";s:0:"";}

Node_Field_Instance.Display_settings:
a:3:{s:5:"label";a:1:{s:6:"format";s:6:"hidden";}s:6:"teaser";a:1:{s:6:"format";s:6:"hidden";}s:4:"full";a:1:{s:6:"format";s:6:"hidden";}}

#9

Vuds - June 8, 2008 - 15:15
Status:active (needs more info)» active

32940stf - "Forgot" it. As I wrote in #4, the inside dropdown labels appear when you choose the "Allow the user to choose a term from any level" option (all of them). If you force to get just the deepest level, the level 1 label (the only one permitted to be written in this setting) doesn't appear.

#10

marcvangend - June 16, 2008 - 20:41

Subscribing.
I have the same problem of field labels not showing up when using content_taxonomy + hierarchical select. I'm 100% sure that I did set a field label on the field settings page.
I created an override for theme_hierarchical_select() and added a line to print out the $element array:

function phptemplate_hierarchical_select($element) {
  print_r($element);
  $output = '';

  // Update $element['#attributes']['class'].
  $hsid = $element['hsid']['#value'];
  $level_labels_style = variable_get('hierarchical_select_level_labels_style', 'none');
  $classes = array(
   'hierarchical-select-wrapper',
   "hierarchical-select-level-labels-style-$level_labels_style",
  );
  $element['#attributes']['class'] .= ' '. implode(' ', $classes);
  $element['#attributes']['id'] = "hierarchical-select-$hsid-wrapper";

  $output .= theme(
    'form_element',
    array(
      '#title' => $element['#title'],
//    '#title' => 'testtitle',
      '#description' => $element['#description'],
      '#id' => $element['#id'],
      '#required' => $element['#required'],
      '#error' => $element['#error'],
    ),
    '<div '. drupal_attributes($element['#attributes']) .'>'. $element['#children'] .'</div>'
  );

  return $output;
}

This shows that $element['#title'] is missing, so obviously it cannot be passed on to theme_form_element(). When you manually assign a value to the #title key (see '#title' => 'testtitle',) the title does show up on the form. Unfortunately I'm not a Form API expert so I couldn't find out more than this.

#11

Wim Leers - June 24, 2008 - 15:23
Status:active» fixed

marcvangend: your comment put me on the right track :) It was just a stupid line that was missing:

         $form[$field_name]['tids'] = array(
+          '#title' => $field['widget']['label'],
           '#type' => 'hierarchical_select',

That fixed it!

#12

Vuds - June 24, 2008 - 19:32

I think that the last version you uploaded doesn't have this patch... I've Just applied it in hs_content_taxonomy.module and it works!

Thanks very much!

#13

Wim Leers - June 24, 2008 - 19:41

I don't upload new versions. Drupal.org's build scripts run automatically every x hours. So it might take some time until until the tarball contains this patch.

#14

marcvangend - June 24, 2008 - 20:49

Re #11:
I'm glad I could help. I figured it would be something rather simple... at least if you know the code. Thanks for the fix.

#15

Anonymous (not verified) - July 8, 2008 - 20:56
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.