I get the following errors on a fresh install of Drupal 7.14:

Notice: Undefined index: taxonomy_term in taxonomy_field_formatter_view() (line 1488 of ***\modules\taxonomy\taxonomy.module).
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7539 of ***\includes\common.inc).

This happens on node preview if a term reference field is set to be hidden on the default display and visible on the teaser.
Here are the steps to reproduce:

  1. install Drupal 7.14 with the minimal profile
  2. enable the following modules: Field UI, Options, Taxonomy
  3. create a new taxonomy and add a couple of terms to it
  4. create a new content type
  5. add a "term reference" field to the new content type with the "select list" widget
  6. make sure the term field is set to "hidden" in the default display
  7. add the term field as a "link" in the teaser display
  8. select one of the terms in a new node's form
  9. preview the node

I found a few similar issues (#1580490: EntityMalformedException: Missing bundle property on entity of type taxonomy_term., #1127606: Undefined index taxonomy_term in taxonomy_field_formatter_view() (line ..., #934726: Undefined index: taxonomy_term in taxonomy_field_formatter_view()), but none seem to actually match my case.

Any help is highly appreciated.

CommentFileSizeAuthor
#1 preview_without_default-1593316.patch699 bytesalexkb

Comments

alexkb’s picture

StatusFileSize
new699 bytes

Hi semiaddict, thanks for posting this - I was also having the same issue.

I've written a very small patch to fix the problem, though I'm not sure if calling taxonomy_term_load() in this context is best practise - attached.

Whilst testing the bug, I also noticed there are similar (although not fatal errors like this one) if you set the display to "Plain" or "RSS category". You should see errors on lines 1502 or 1513 of modules/taxonomy/taxonomy.module (before it's patched), respectively for those display types.

If you don't wish to apply the patch, the problem can be fixed, simply by setting the taxonomy terms not to display in the teaser.

Cheers.

marcingy’s picture