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.
Since VBO offers already the possibility to resave all nodes, it would be an awesome feature to be able to resave/update entities as well.
Having this feature would make it possible to bulk update Geocoder Fields, etc.
In the meantime, I found out how to do it via the "Execute arbitrary PHP" action. Here is the code:
$entity_type = '{ENTITYTYPE}';
$wrapper = entity_metadata_wrapper($entity_type, $entity);
$wrapper->save();
Replace {ENTITYTYPE} with your entity type. Use the Devel module to find the entity type on any entity page by adding "/devel" to the end of the URL.
I hope this helps those looking for a workaround in the meantime.
Comment | File | Size | Author |
---|---|---|---|
#3 | views_bulk_operations-entity_save_action-2551349-1.patch | 1.2 KB | bgilhome |
|
Comments
Comment #2
NWOM CreditAttribution: NWOM commentedComment #3
bgilhome CreditAttribution: bgilhome commentedI needed this feature, for the use case of updating auto entity labels on entities of a custom ECK entity type. It just needed an Action plugin, patch attached should work for any entity type.
Comment #4
Graber CreditAttribution: Graber as a volunteer commentedHmm, why not add this action to Drupal core instead?
Comment #5
matthieu_collet CreditAttribution: matthieu_collet commentedThank you for the patch @bgilhome
I tried it on users, but it doesn't update computed fields, is it normal ?
Comment #6
dqd@Graber: from what I remember core had previously only Node Bulk Actions? Does it has Entity Bulk Actions now too? If so, then you would be right.
Apart from that: does this need a reroll for Drupal 10/11 and PHP8 ?
Comment #7
dqdAssuming a bright future for more other entities than nodes in Drupal, I set it to major FR and NW.