Trying to change basic information or just saving when of the field with the widget type tree creates the following error:

Fatal error: Cannot use string offset as an array in /home/mysite/public_html/sites/all/modules/content_taxonomy/content_taxonomy_tree.module on line 179

Comments

mh86’s picture

there have been changes in the Taxonomy Manager.
It seems like I have to update the Content Taxonomy integration too

j0rd’s picture

Confirming this bug. Just got it myself =(

I don't know if this fixes is, as I don't really know what the code is doing other than looking for "selected terms".. So I took a guess and created this code, to stop the error, but might not be proper and cause a bug. Please have a developer look over it to make sure I'm not completely messing it up. As mentioned, I did not trace any code to make sure this is a proper fix, but only resolves the PHP error.

If you have devel installed you can remove the dpr/dpm comments to trace the code a little bit.

function content_taxonomy_tree_form2data($element, &$form_state, $field) {
  $field_key  = $element['#columns'][0];

  //dpr(array("field_key" => $field_key, "form_state" => $form_state, "element" => $element)); 
  //exit; 

 // $selected_terms = $form_state['values'][$element['#field_name']][$field_key]['selected_terms'];
  $selected_terms = $form_state['values']['default_value'];
                                                                                                                
  if (!is_array($selected_terms) || !count($selected_terms)) {
    $selected_terms[] = NULL; 
  }
  else {
     foreach(array_values($selected_terms) as $term) {
        foreach($term as $key => $value) {
           //dpm(array("KEY"=> $key, "VALUE" => $value)); 
           $selected_values[] = $value;
        }
     }
     $selected_terms = $selected_values;
  }

  $form_state['#field_info'][$field['field_name']] = $field;
  return content_transpose_array_rows_cols(array($element['#columns'][0] => array_values($selected_terms)));
}                                                                                                               

mh86’s picture

Component: Option Widgets » Taxonomy Tree
Status: Active » Postponed (maintainer needs more info)

I can't reproduce this issue.
On my testing sites I'm using the newest Content Taxonomy version and beta2 of Taxonomy Manager.
Does this problem still exists for you?

mh86’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

closing this very old issue. try newer versions and reopen if problem still exists