I have created a basic Person node with two basic CCK text fields, First Name and Last Name. I have created a table view around this node, which works fine. However, if I create a view object using views_get_view (in code) and inspect that object, both CCK fields have a blank label. All of the other non-CCK fields have the correct label. Any thoughts on what maybe causing this?

Here is the value of $view->display['default']->display_options['fields'] . I've removed all but the two CCK fields and one other normal node field.

[fields] => Array
  (
      [field_first_name_value] => Array
          (
              [label] => 
              [link_to_node] => 0
              [label_type] => widget
              [format] => default
              [multiple] => Array
                  (
                      [group] => 1
                      [multiple_number] => 
                      [multiple_from] => 
                      [multiple_reversed] => 
                  )

              [exclude] => 0
              [id] => field_first_name_value
              [table] => node_data_field_first_name
              [field] => field_first_name_value
              [override] => Array
                  (
                      [button] => Override
                  )

              [relationship] => none
          )

      [field_last_name_value] => Array
          (
              [label] => 
              [link_to_node] => 0
              [label_type] => widget
              [format] => default
              [multiple] => Array
                  (
                      [group] => 1
                      [multiple_number] => 
                      [multiple_from] => 
                      [multiple_reversed] => 
                  )

              [exclude] => 0
              [id] => field_last_name_value
              [table] => node_data_field_last_name
              [field] => field_last_name_value
              [override] => Array
                  (
                      [button] => Override
                  )

              [relationship] => none
          )

      [created] => Array
          (
              [label] => Post date
              [date_format] => small
              [custom_date_format] => 
              [exclude] => 0
              [id] => created
              [table] => node
              [field] => created
              [override] => Array
                  (
                      [button] => Override
                  )

              [relationship] => none
          )

  )
CommentFileSizeAuthor
#1 add_label_to_field_definition.patch645 bytesjhuckabee

Comments

jhuckabee’s picture

Status: Active » Needs review
StatusFileSize
new645 bytes

Looks like the label was only getting saved in the display options when a custom label was set for a CCK field. I've added the options_submit function to views_handler_field_content to ensure the label gets set when the field is saved. I'm attaching a patch for review.

karens’s picture

Status: Needs review » Fixed

I confirmed the problem and that the solution works. I also found our current processing, which wraps a t() around the label, was incorrect since that option is marked by Views as a translatable field and should hold the untranslated value, so I fixed that, too.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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