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.
After #2156273: Update admin_views provided view to match admin/content/file was committed, I just noticed that the "Choose an operation" select options are different than the default options.
Here's without VBO and admin_views modules
Here's with VBO and admin_views modules
Comment | File | Size | Author |
---|---|---|---|
with-vbo.jpg | 146.65 KB | gmclelland | |
without-vbo.jpg | 162.55 KB | gmclelland |
Comments
Comment #1
gmclelland CreditAttribution: gmclelland commentedHmm... I'm not sure why, but I don't even see those options to add if I edit the view that controls admin/content/file under "Bulk operations"
This also prevents users from using admin_views with the file_lock module, because the file lock options won't display in the "Bulk operations." As a side note you need the patch from #2244399: Accommodate renamed file_operations hook if you want the file_lock options to appear.
Comment #2
kmoll CreditAttribution: kmoll commentedI'll need to look into it to see. I think it might just be a labeling issue where the non-vbo page says "delete" and the vbo page says "delete selected files". So the actions might operate the same but just be outputed with a different label. I will go through it and check it out and see what we can do to make them the same
Comment #3
gmclelland CreditAttribution: gmclelland commentedThanks @kmoll. I may be way off, but I almost wonder if the operations listed in the select box need to be declared as actions with hook_action_info so that the views_bulk_operations module can see those actions as a option to configure in the default view provided by the file_entity module?
For the file_entity module, I'm referring to the options:
"Indicate that the selected files are permanent and should not be deleted" and
"Indicated that the selected files are temporary and should be removed during cron runs"
Basically it seems like the vbo view doesn't see any operations that are declared with hook_file_operations.
I wonder if there is a way to for each item that implements hook_file_operations to be declared as an action somehow so that View Bulk Operations can see it as an option?
Comment #4
gmclelland CreditAttribution: gmclelland commentedSo coming from the vbo documentation at [#1591352], it says:
So the operations we see in https://www.drupal.org/files/issues/with-vbo.jpg are coming from the default actions provided by the views bulk operations module.
The operations we see in https://www.drupal.org/files/issues/without-vbo.jpg are coming from the everything that implements hook_file_operations that is defined in the file_entity module.
That explains why the options are different.
Now, I'm not sure what the best way is to proceed?
Comment #5
kmoll CreditAttribution: kmoll commentedI am thinking we can implement hook_action_info, and call all module sthat implement hook_file_operatations to create an action that can be used with VBO. Just my first thought.
Comment #6
gmclelland CreditAttribution: gmclelland commentedThat's sort of what I was thinking, but I don't quite have the coding knowledge to do this.
Looks like these are some of the modules that might need to be modified:
https://www.drupal.org/project/file_admin
--provides "Publish/Unpublish" and "Promote/Demote selected files"
https://www.drupal.org/project/file_lock
--provides "Lock/Unlock selected files"
File Entity
--provides "Update URL alias",
-- Indicate that the selected files are permanent and should not be deleted
-- Indicate that the selected files are temporary and should be removed during cron runs
-- Delete selected files
-- Edit selected files
Comment #7
kmoll CreditAttribution: kmoll commentedI'll be able to take a look, but I should be able to figure it out. We shouldn't have to modify the other modules, we should be able to call the other modules that implement hook_file_operations without modifying those other projects. That is my hope anyways. I should be able to look at the code later on this evening or tomorrow morning.
Comment #8
gmclelland CreditAttribution: gmclelland commentedAwesome. Sounds great
Comment #9
kmoll CreditAttribution: kmoll commentedComment #10
kmoll CreditAttribution: kmoll commentedThis is going to be more complicated than I originally thought. hook_file_operations() works differently than creating actions for VBO, which follows Drupal's action infrastructure. There isn't a way (or at least a way that isn't extremely complex) to automatically translate functionality defined in hook_file_operations to VBO within the file_entity module. We can easily create actions based on the operations defined within the file_entity module, but other modules would have to implement it themselves to support the VBO and I don't think we want to ask other module to have to support two different ways of updating those pages.
I think this is going to require a deeper conversation about how we want to address this.
Comment #11
gmclelland CreditAttribution: gmclelland commentedI agree, this needs some more discussion. I was wondering how that would work since they are different.
I'm not quite sure, but another thing to keep in mind is maybe if the other modules declare the actions that would probably help once we get rules integration at #826986: File API events?
I think the rules module uses the actions to react on events?
I may be wrong but I don't see a lot of modules that use this hook so it might not be that big of an issue to add the actions to those modules?
Comment #12
gmclelland CreditAttribution: gmclelland commentedComment #13
kmoll CreditAttribution: kmoll commented@gmclelland At Drupalcon this week and will speak to the guys here about what to do with this. I brought it up briefly this morning, and I think the answer will end up being that it will work slightly different. But I will bring it back up and get a game plan for how to handle it.
Comment #14
firewaller CreditAttribution: firewaller commented+1