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
When called from the Entity API's entity_view(), file_view_multiple() has parameters in an unexpected order. The $langcode parameter is actually the entity type ("file") and the $weight parameter is the true langcode. This means the langcode is lost when files are viewed using entity_view().
Proposed resolution
Rather than change the API's of entity or file_entity, add a simple check for this discrepancy, and fix it.
Remaining tasks
Review the attached patch.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#1 | file_entity-2405475-entity_view_param_discrepancy.patch | 704 bytes | brockfanning |
Comments
Comment #1
brockfanning CreditAttribution: brockfanning commentedComment #2
Dave ReidIs this resolved with #2365821: entity_view('file') returns data nested in 'files' array, but should use entity type 'file' in the latest dev release?
Comment #3
brockfanning CreditAttribution: brockfanning commentedYes, that handles it nicely! Sorry about that. For some reason I thought I was testing the dev version, but apparently was not.