Posted by myha on July 20, 2011 at 2:03pm
1 follower
| Project: | AHAH helper |
| Version: | 6.x-2.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I use ahah_helper on the node form witch has few taxonomies (including free tags). When ahah elements refreshes in the log I receive 4 same errors with different line number on the taxonomy.module:
Illegal offset type in modules/taxonomy/taxonomy.module on line 606Investigating noticed thet this happens after this code:
<?php
// hack to stop taxonomy from resetting when the form is rebuilt
$form_state['node']['taxonomy'] = taxonomy_preview_terms($node);
?>Looks taxonomy_preview_terms() func is calling later by taxonomy module also. Cccurs php error because with term object works as with single value. Taxonomy module has condition to eliminate this:
<?php
if (!is_object(current($node->taxonomy))) {
$node->taxonomy = taxonomy_preview_terms($node);
}
?>but it fails because in my case first element is 'tags' array.
For fix this I move 'tags' element into the end of taxonomy array. So changed existing code to:
<?php
// hack to stop taxonomy from resetting when the form is rebuilt
$form_state['node']['taxonomy'] = taxonomy_preview_terms($node);
if($tags = $form_state['node']['taxonomy']['tags']){
unset($form_state['node']['taxonomy']['tags']);
$form_state['node']['taxonomy']['tags'] = $tags;
}
?>Also tested removing this peace of code - no issues received and looks taxonomy stored properly. Perhaps it can be removed?