We have a content type with a term reference field that is hidden on page display, and while working with the Metatags module I noticed that tokens referencing fields that are hidden on the page display type were not being populated, and in fact were generating errors in the taxonomy field module. If I made the field visible in the display type, it worked fine.

Further investigation through the call stack found that the entity being used was already processed for the current page display type (in which the hidden fields were not fully processed), and when subsequent field format calls were made on the entity's fields, no hook_field_formatter_prepare_view hooks were being invoked on the fields due to $entity->_field_view_prepared being set to TRUE on the cloned entity.

This patch resets that flag on the cloned entity prior to running through the field rendering code, allowing all fields to be rendered on the entity for the "token" display type, resulting in all field tokens being processed fully and available for use.

Files: 
CommentFileSizeAuthor
#7 token-field-view-prepare-reset-1508404-7.patch641 bytesjec006
PASSED: [[SimpleTest]]: [MySQL] 307 pass(es).
[ View ]
#4 token-7.x-1.0-rc1-field_view_prepared_reset-1508404.patch645 bytesarpieb
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch token-7.x-1.0-rc1-field_view_prepared_reset-1508404.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#2 token-7.x-1.0-rc1-field_view_prepared_reset.patch658 bytesarpieb
FAILED: [[SimpleTest]]: [MySQL] Invalid patch format in token-7.x-1.0-rc1-field_view_prepared_reset_0.patch.
[ View ]
token-7.x-1.0-rc1-field_view_prepared_reset.patch576 bytesarpieb
FAILED: [[SimpleTest]]: [MySQL] Invalid patch format in token-7.x-1.0-rc1-field_view_prepared_reset.patch.
[ View ]

Comments

Status:Needs review» Needs work

The last submitted patch, token-7.x-1.0-rc1-field_view_prepared_reset.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new658 bytes
FAILED: [[SimpleTest]]: [MySQL] Invalid patch format in token-7.x-1.0-rc1-field_view_prepared_reset_0.patch.
[ View ]

Botched patch generation - here's a good one.

Status:Needs review» Needs work

The last submitted patch, token-7.x-1.0-rc1-field_view_prepared_reset.patch, failed testing.

StatusFileSize
new645 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch token-7.x-1.0-rc1-field_view_prepared_reset-1508404.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Third time's the charm...

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, token-7.x-1.0-rc1-field_view_prepared_reset-1508404.patch, failed testing.

Version:7.x-1.0-rc1» 7.x-1.x-dev
Status:Needs work» Needs review
StatusFileSize
new641 bytes
PASSED: [[SimpleTest]]: [MySQL] 307 pass(es).
[ View ]

Here's a better version

Status:Needs review» Fixed

Makes sense since this seems to happen because meta tag calls token replacement from within hook_field_attach_view(). Committed to 7.x-1.x with http://drupalcode.org/project/token.git/commit/34b6142

Status:Fixed» Closed (fixed)

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