I am getting this error:

EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7562 of /includes/common.inc).

I'm stuck debugging this. All I have is:

  • The nodes this is about have several taxonomy terms.
  • At the spot where the exception is thrown, some taxonomy fields only contain one element: the tid. Others contain more elements including the object "taxonomy_term".
  • The reason why the exception is thrown is, that in taxonomy.module::taxonomy_field_formatter_view() the $term passed to entity_uri() (and then to entity_extract_ids() is $term = $item['taxonomy_term'];, which for some fields does not exisit (as mentioned above).
  • Maybe it's helpful to know that I'm coming from d6 with this site.

I'd be really grateful for every hint. I can't find why some taxonomy fields are not populated.

CommentFileSizeAuthor
#3 1736466.taxonomy_term_bundle_name.patch466 bytesrszrama
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rmfleet’s picture

I have received this same error code on the same line while displaying a specific content type in a view as a blog roll.

I changed the pager output from 'full' to 'mini' and the error disappeared. If pager items per page is larger than the number of nodes to be displayed, the error does not occur when using the full pager. I am using 7.16.

GiorgosK’s picture

rszrama’s picture

Title: Missing bundle property on entity of type taxonomy_term » taxonomy_entity_info() uses the wrong 'bundle_keys' bundle name for taxonomy_term
Version: 7.15 » 7.x-dev
Category: support » bug
Status: Active » Needs review
FileSize
466 bytes

I believe this is a result of a bug I discovered in the entity info for taxonomy terms. The entity keys array uses the correct bundle key name for taxonomy terms (vocabulary_machine_name), but the bundle keys array that's used by a couple API functions like this uses a wrong name (machine_name). Attached patch updates these to match and fixes my issue - and I'm guessing yours.

Status: Needs review » Needs work

The last submitted patch, 1736466.taxonomy_term_bundle_name.patch, failed testing.

wgsimon’s picture

I had a similar problem when calling field_extract_bundle() on a taxonomy_term entity type. The patch seems to have solved the problem.

wgsimon’s picture

Just noticed that this breaks the call to field_extract_bundle( ) in field_ui_field_overview_form( ) in field_ui.admin.inc.

wodenx’s picture

I can confirm that the patch in #3 is definitely incorrect. See #2024813: hook_entity_info_alter on taxonomy_term "bundle keys" breaks "Manage Fields"

FranciscoLuz’s picture

Issue summary: View changes

#6 seems to be right. I also had the same issue, that is, the taxonomy field ui breaks due to the following piece of code.

/**
 * Implements hook_entity_info_alter().
 *
 * The core Taxonomy module specifies an incorrect bundle key name for the
 * taxonomy_term entity type. Once core is patched, this alter hook can be
 * removed, but in the meantime it is essential for flattening fields on
 * taxonomy term entities.
 *
 * @see http://drupal.org/node/1736466
 */
function commerce_services_entity_info_alter(&$info) {
  $info['taxonomy_term']['bundle keys']['bundle'] = 'vocabulary_machine_name';
}
lachezar.valchev’s picture

Hi,

Agreed with wodenx the difference between the

'entity keys' => array(
  'id' => 'tid',
  'bundle' => 'vocabulary_machine_name',
  'label' => 'name',
),

and

'bundle keys' => array(
  'bundle' => 'machine_name',
),

is intentional as described in #2024813: hook_entity_info_alter on taxonomy_term "bundle keys" breaks "Manage Fields"

Regards,
Lachezar