Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
1. Do a clean Drupal install.
2. Add a term to taxonomy "Tags".
3. Change content type Article, Manage Display, and set the Tags field to Hidden.
4. Go to create an Article node, set the Tag to the term you added in step 2, do not save but click on Preview.
The following errors will show:
Proposed resolution
Remaining tasks
Check for the bug in 8.x
Determine the cause of the error.
Write a patch.
User interface changes
API changes
Original report by @psheiman
When node has some term_reference fields filled, for some reason 'taxonomy_term' item not being loaded in taxonomy_field_formatter_view().
Occurs when the term field is set to hidden, and a node is previewed prior to creating it.
Comment | File | Size | Author |
---|---|---|---|
#4 | before.png | 11.36 KB | dcam |
fixed__undefined_index__taxonomy_term_in_taxonomy_field_formatter_view()_.patch | 507 bytes | Anonymous (not verified) | |
Comments
Comment #1
naxoc CreditAttribution: naxoc commentedWhat are the steps to reproduce this?
Comment #2
neRok CreditAttribution: neRok commentedNo steps to reproduce posted, so I think this is safe to close.
Comment #3
Bagz CreditAttribution: Bagz commentedThis is still a bug and is very easily reproduced:
1. Do a clean Drupal install.
2. Add a term to taxonomy "Tags".
3. Change content type Article, Manage Display, and set the Tags field to Hidden.
4. Go to create an Article node, set the Tag to the term you added in step 2, do not save but click on Preview.
The following errors will show:
Comment #4
dcam CreditAttribution: dcam commentedI can confirm the bug for 7.x. I can't check for the bug 8.x right now due to #2276705: Cannot create image styles on Wamp server (Apache/windows).
Setting Needs Review to test the patch in the issue summary.
Comment #5
dcam CreditAttribution: dcam commentedMeh. Testbot doesn't seem to want to test the patch. It needs work anyway because we'll need a test for this.
Comment #6
hwasem CreditAttribution: hwasem commentedI'm also getting this error when previewing one of my content types, branch. Interesting, it is not all content types that use that vocabulary/term combination (for instance Events are fine). I don't understand that.
I'm using core 7.28. I'll be updating on Monday to see if it is happening in 7.31.
Comment #7
hwasem CreditAttribution: hwasem commentedI upgraded to 7.31 today and I still get the error as outlined above, with a line change on the second error:
I tried the patch in #1 above and received a different set of error in entity_translation. Not sure if they are worth mentioning since the lines I applied the patch to were not 1440 as indicated in the patch, but 1601 where my errors were. And that patch is 2 years old.
I'm just sure where to go since I'm not great at understanding PHP. Any ideas or things to try would be very helpful.
Thanks,
Heidi
Comment #8
David_Rothstein CreditAttribution: David_Rothstein commented