As we've classed objects now, let's remove the $entity_type paramter from hook_file_download_access(). Also we should add type-hinting for the $entity parameter.

core/modules/comment/comment.module:function comment_file_download_access($field, $entity_type, $entity) {
core/modules/file/file.api.php:function hook_file_download_access($field, $entity_type, $entity) {
core/modules/file/file.api.php:function hook_file_download_access_alter(&$grants, $field, $entity_type, $entity) {
core/modules/file/tests/file_module_test.module:function file_module_test_file_download_access($field, $entity_type,
core/modules/node/node.module:function node_file_download_access($field, $entity_type, $entity) {
core/modules/user/user.module:function user_file_download_access($field, $entity_type, $entity) {

Comments

berdir’s picture

Might want to postpone this on #1245220: file_file_download() passed bogus $field to field_access() or actually just close this is issue as a duplicate of that one. That is shuffling around the parameters of hat function around anyway already. At least for the alter hook.

fago’s picture

I'm not sure on postponing this on the other issue, as it doesn't look like there is consensus on how to proceed over there. If the other patch can take care of it earlier, why not.

fgm’s picture

Status: Active » Needs review
StatusFileSize
new5.51 KB

If anything, this patch reduces the overall number of parameters, hence also reduces the shuffling involved.

berdir’s picture

Note that the other issue is already doing exactly this. I'd prefer getting that one reviewed and commited instead of producing conflicts :)

fgm’s picture

Well if it's exactly the same there won't be any conflict :-)

berdir’s picture

It's not exactly the same, the other issue also contains other changes.

Status: Needs review » Needs work

The last submitted patch, 0001-Issue-1618158-remove-entity_type-from-hook_file_down.patch, failed testing.

fgm’s picture

Status: Needs work » Closed (duplicate)

#1245220: file_file_download() passed bogus $field to field_access() is now RTBC and includes this one, so if it gets committed we will no longer need this one.