I've noticed that, when adding fields to a content revision page, the automatically generated machine names contain dashes. ('field_assigned_user-revision_id', for example.) This specifically seems to cause a problem when attempting to override the theme for the specific field with a template.

This all seems to stem from a dash being used instead of an underscore to combine the field name and the 'revision_id' string in field.views.inc, on line 191 (line 187 in 7.x-3.x-dev). Is there any reason I'm missing for the dash? Locally, if I change it to an underscore and re-create my fields, the field-specific template files immediately begin working. (Well, with a cache refresh.) I suppose it's mostly an issue with converting to and from dashes and underscores in the template file names, but machine name dashes seem inconsistent in general.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

doktorjung’s picture

(I should specify that this is for 'Content(historical data)' fields.)

keesje’s picture

Issue summary: View changes

I believe this is fixed somewhere between 3.7 and 3.10

mpadilla’s picture

I think not. I have the same problem in views 7.x-3.14. I applied the same solution.

Eric_A’s picture

Version: 7.x-3.3 » 7.x-3.x-dev
FileSize
566 bytes

So here's a patch, presumably authored by @keesje, re-rolled by @eruiter. Traced it to this issue.

Eric_A’s picture

Status: Active » Needs review
DrIPA’s picture

Renamed patch to Drupal naming conventions

Eric_A’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#1353064: Standardize on use of underscore vs hyphen in machine names

Not sure about potential BC-issues, but if theming is broken... This is a straightforward bug fix. And then there's the matter of standardisation.

whthat’s picture

This does appear to get the field template file names working! It also breaks existing content revision views with Broken/Missing Handle on each historical fields but these can be removed and added back to work.

The patch appears to be functional for proper template file naming on historical revision based fields.

Unfortunately I would need to wait until this is committed to a release before I would commit time to rewriting our numerous revision based views required for implementation.

das-peter’s picture

Just came across this issue and found a related issue #2335555: Display plugin (views_plugin_display) ignores template (tpl) files for a revision field.
I think we should incorporate the changes from both issues and it seems like there's a facility to "move" fields too - maintaining bc.
Attached patch should do the trick.

Chris Matthews’s picture

Status: Reviewed & tested by the community » Needs review

Setting back to Needs review per the comments and patch in #9