i've tried stable and latest dev versions of the modules
i have a field collection with a taxonomy term field, and when i want to display a full node using the field collection table view i get the following errors for each occurrence of the term field:
Notice: Undefined index: taxonomy_term in taxonomy_field_formatter_view() (string 1409 in /modules/taxonomy/taxonomy.module).
Notice: Trying to get property of non-object in taxonomy_field_formatter_view() (string 1409 in /modules/taxonomy/taxonomy.module).
the corresponding term fields are shown empty
when i switch to simple view everything is working like it should. in fact the table view also was working for me before, but after some update, i'm not sure which and where, it stopped working. i even reinstalled the whole drupal installation, and recreated the site anew to encounter the same error. maybe some update at the hosting server could cause it?
the hosting environment:
Drupal 7.7
PHP 5.2.17
mysql 5.1.56-log
Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
help me please
Comment | File | Size | Author |
---|---|---|---|
#18 | 1259916-field-prepare-buildcontent.patch | 1.1 KB | Damien Tournoud |
#14 | 1259916-entity-field_attach_prepare_view.patch | 1.41 KB | ygerasimov |
#8 | entity-1259916-8.patch | 1.03 KB | tim.plunkett |
#3 | entity-1259916-3.patch | 705 bytes | tim.plunkett |
Comments
Comment #1
tim.plunkettWill attempt to debug and fix. Thanks for the bug report!
Comment #2
craigmc CreditAttribution: craigmc commentedAlso seeing this issue with taxonomy term fields in a field collection.
Tried all different settings for the term field display option (text, link, hidden) as hinted at in http://drupal.org/node/934726#comment-3924552 with no luck.
Comment #3
tim.plunkettThis might be me fundamentally misunderstanding the difference between
Entity::buildContent()
andEntity::view()
, but the former is missingfield_attach_prepare_view()
, and this fixes the above issue with reference fields.Comment #4
tim.plunkettI'm guessing the difference is explained by #1227800-8: Ease programmatic manipulation of values within collections.
Comment #5
JustMagicMaria CreditAttribution: JustMagicMaria commentedSubscribing
Comment #6
srgk CreditAttribution: srgk commentedwhat about the patch in #3? it looks inaccessible
Comment #7
zkday CreditAttribution: zkday commentedcan't views patch file in comment #3
This url is: http://drupal.org/files/issues/
Comment #8
tim.plunkettSorry about the delay, here's the patch again.
Comment #9
fagohm, but now it's run twice, isn't it?
Comment #10
tim.plunkettField Collection Table is using buildContent in hook_field_formatter_view(). Should it not be?
I don't understand #9.
Comment #11
Remon CreditAttribution: Remon commentedsubs
Comment #12
j0rd CreditAttribution: j0rd commentedI get a similar error on my site (both 7.7 and 7.8).
For me, it's very easy to duplicate. I have a node with the preview option enabled. If I preview, then preview again, I get the error I posted above.
Not exactly too sure what the problem is, but may be related. I'll test the patch when I get a second.
UPDATE: I just tested this patch against my problem and it did not resolve it.
--
Drupal Commerce Development & Themes
Comment #13
fagoWell, field_attach_prepare_view is already invoked by entity_view(). However I found that:
So does that internal flag cover our situation too? If so, at least we also need to add a comment like that.
Comment #14
ygerasimov CreditAttribution: ygerasimov commentedI got same problem when attaching entityreference field and use buildContent method to get the content.
It looks like internal flag doesn't cover our situation as field_attach_prepare_view() will invoke hooks anyway.
Shall we move field_attach_prepare_view() and entity_prepare_view() to buildContent() method completely as per attached patch?
Comment #15
fagoFrom looking at the code I think it should cover our case too?
#14 is no real solution as it does away with multiple-preparing on view, what is important in case of having multiple view operation.
Thus, let's go with #8. But let's verify the flag to prevent it preparing twice works and add a comment to it as the one I quoted in #13.
Comment #16
tim.plunkettWill test and reroll.
Comment #17
Damien Tournoud CreditAttribution: Damien Tournoud commentedSo, what's the difference between buildContent() and view() and why do we need both here?
Comment #18
Damien Tournoud CreditAttribution: Damien Tournoud commentedRerolled #8. It is indeed the proper fix.
Comment #19
Damien Tournoud CreditAttribution: Damien Tournoud commentedComment #20
fagoI verified it's indeed run only once. Thanks, committed.
Comment #21.0
(not verified) CreditAttribution: commentedadded info about the empty term fields