This error is thrown because Drupal checks for the vocabulary machine name as a result of calling entity_label in _term_reference_tree_get_options.

I've attached a quick-fix patch. There is probably a more efficient location to do change from vid to machine_name.

Comments

nikosnikos’s picture

Priority: Normal » Major

I tried to apply the patch but it didn't solve the problem.

The bug appears in every page that should display the term reference tree (node edit, taxonomy reference field edit on content type) just after having set the widget type to "term reference tree".

I set the status to "major" because it's not possible anymore to edit a node (with a "term reference tree" widget) or to edit the taxonomy reference field. The only way to get the site back is to edit admin/structure/types/manage/my_content_type/fields/field_my_vocab/widget-type or to disable the module.

nikosnikos’s picture

The exact error is : EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7539 of /home/public/www/atdqm/includes/common.inc).

Taxoman’s picture

Priority: Major » Critical
Taxoman’s picture

Version: 7.x-1.9 » 7.x-2.x-dev

What is the status of this one, fixed or not a problem in 2.x?

ipwa’s picture

my-family’s picture

In our case, the problem is in combination with the Title module: http://drupal.org/project/title

pyry’s picture

Patch worked for me.

In my case the widget was applied directly to custom form generating code.

function MYMODULE_subscriptions_form($form, &$form_state) {
  $term_reference_tree_path = drupal_get_path('module', 'term_reference_tree');
  $vocabularity = taxonomy_vocabulary_machine_name_load('products');
  $form['product_categories'] = array(
    '#title' => 'Products',
    '#type' => 'checkbox_tree',
    '#max_choices' => 999,
    '#leaves_only' => 0,
    '#start_minimized' => TRUE,
    '#depth' => 0,
    '#vocabulary' => $vocabularity->vid,
    '#parent_tid' => 0,
    '#value_key' => 'tid',
    '#select_parents' => false,
    '#attached' => array(
        'js' => array($term_reference_tree_path . '/term_reference_tree.js'),
        'css' => array($term_reference_tree_path . '/term_reference_tree.css')
    ),
    '#attributes' => array('class' => array('field-widget-term-reference-tree')),
    '#max_depth' => 100,
    '#field_name' => '',
    '#token_display' => false,
    '#filter_view' => '',
  );
  return $form;
}
jpsolero’s picture

I think we could improve performance in this patch

jpsolero’s picture

StatusFileSize
new652 bytes

Patch in #1 should work.

But this patch is more efficient.

jherencia’s picture

#9 - I agree

jpsolero’s picture

Patch in 9 failed testing.

This one is ok

mikran’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new841 bytes

#11 works. Here is the same patch for 7.x-1.x-dev

inventlogic’s picture

got this. like the widget.

will the patch be committed?

chingis’s picture

In case when you have "N/A" option and locale module enabled, this exception still thrown
Patch attached

maxplus’s picture

Hi,

patch #14 works for me for the current stable Taxonomy Term Reference Tree Widget 7.x-1.9 in combination with Drupal Commerce Kickstart 7.x-2.4

Thanks for the good help!

chanac_hares’s picture

patch #14 works for me too

a big thank you !

sibiru’s picture

Hi, patch #14 works for me too (Drupal Commerce 7.15)

dianikol’s picture

Patch from #14 works for me too with the latest commerce kickstart v2

dave reid’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new3.54 KB

Hrm, I wanted to see if we could avoid having to load the vocabulary twice, and I think this should work. Could someone in this issue confirm this patch works just as well as #14?

mglaman’s picture

StatusFileSize
new41.15 KB

I just applied your patch and it worked. Like a charm - attached screenshot as proof.

dave reid’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Fixed

Committed #19 with a couple more fixes to 7.x-1.x. This is now considered resolved.
http://drupalcode.org/project/term_reference_tree.git/commit/8ddbe4f

For those of you using the 2.x branch, this would need to be up-ported and I am not sure of the status of that branch. I would suggest downgrading to 1.x

Status: Fixed » Closed (fixed)

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