Problem/Motivation
I wrote a module which provides integration with GBIF (Global Biodiversity Information Facility). It contains a submodule to directly display remote GBIF data with Views. It is possible to couple it with VBO to locally process GBIF occurrences (for instance, migrate data to Drupal, with some alterations).
This worked just fine in Drupal 7 (I only had to use a "fake" entity with a table which remained always empty, in order to satisfy VBO). However, after porting the module to Drupal 9, I am unable to replicate this behaviour.
I followed this piece of documentation on view providers API, hence this event subscriber and this entity getter.
You can also take a look my implementation of hook_views_data(). Although VBO will not complain, two weird things happen when I try to use actions on this type of view:
1) There is a frame ("Selected 1 item in this view") which does not appear on a node-based view, plus, it detects no item even though one check box is active:

2) The confirmation page also displays "No items" instead of listing the selected entities, and my action is not fired.
There is an entity integration using the External Entities module. However, I gave it a try with $event->setEntityTypeIds(['node']); in the event subscriber while returning a node in the entity getter, and observed the same behaviour. Please not there is is no `_entity` key in rows (see the query plugin). I tried to add one there, to no avail.
Steps to reproduce
Install the GBIF (gbif2_views, which should depend on gbif2 and gbif2_entity) and Views Bulk Operation modules. External Entities will be required by Composer, otherwise download it manually. Check that a GBIF occurrence external entity (admin/structure/external-entity-types) is created (based on this piece of configuration). Build a view based on "GBIF occurrences" and add an action.
Could you please help me find what I have been missing in my integration with Views and VBO?
| Comment | File | Size | Author |
|---|---|---|---|
| gbif_vbo.png | 76.39 KB | fmb |
Comments
Comment #2
fmb commentedComment #3
fmb commentedComment #4
graber commentedhttps://www.drupal.org/docs/8/modules/views-bulk-operations-vbo/view-pro...
Check https://www.drupal.org/project/search_api for an example.
Comment #5
graber commentedHmm, if that doesn't help it means debugging time :)
Comment #6
fmb commentedThanks for your answer! I've read the implementation in Search API, however I can't see much difference with what I tried in my event subscriber and my entity getter.
Actually, there are two possible issues: either there is something wrong with the way I declared my view type and plugins, or VBO is somehow troubled by entities with no table in the database (external storage). Do you think VBO can handle entities like the ones declared by External Entities in the first place?
Comment #7
fmb commentedAlso, now I'm thinking about it, could this be related to #2079019: Make Views use SqlEntityStorageInterface?
Comment #8
fmb commentedI've fixed it, thanks for your time. The trouble was my implementation of addWhere(). This method is called by ViewsBulkOperationsActionProcessor::populateQueue() but didn't do anything useful as it is not much relevant for my use case.
Comment #9
graber commentedAwesome! Is there something we can improve in the docs?
Comment #10
fmb commentedDone!