We're seeing an issue after upgrading to version 3.3. On the confirmation page the ids of the items to be processed are no longer being rendered. See the attached file for a screenshot of what we're seeing.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcave created an issue. See original summary.

msteer’s picture

This has happened to me too, on a view whose base entity is commerce license entities.

In 7.x-3.2, the views_bulk_operations.module theme function theme_views_bulk_operations_confirmation() used to use it's own entity label fallback function called _views_bulk_operations_entity_label($entity_type, $entity). Now, 7.x-3.3 is just using the core's entity_label($entity_type, $entity) function.

I've just checked the commerce_license.module:hook_entity_info() and 7.x-1.3 doesn't currently set a 'label callback' function when it registers the entity... so I used hook_entity_info_alter() in my own module to inject a custom entity label callback function, which works great! VBO now displays this string in the list on the VBO confirmation page.

Hope this helps.

msteer’s picture

msteer’s picture

msteer’s picture

dhansen’s picture

Version: 7.x-3.3 » 7.x-3.x-dev
Status: Active » Needs review
FileSize
2.24 KB

Doing some follow up as this issue came up with a client running Ubercart.

TR makes a compelling argument on the Ubercart issues page as to why entity_label() doesn't work for uc_orders in #4 on #2921933: Add 'label' to uc_order entity keys declaration. As such, I'm putting up a patch that's not quite rolling back the change on 3.3 (which doesn't seem to have as issue associated with it; it's referenced in the changelog as "Remove an entity_label() workaround that core no longer needs.") but provides a fallback of the entity ID in the cases where entity_label() returns FALSE.

joelpittet’s picture

Status: Needs review » Needs work

Thanks for the patch, it looks like it's going in the right direction.

+++ b/views_bulk_operations.module
@@ -654,8 +654,10 @@ function theme_views_bulk_operations_confirmation($variables) {
+    if (!$label = entity_label($entity_type, $entity))

@@ -1106,10 +1108,12 @@ function views_bulk_operations_queue_item_process($queue_item_data, &$log = NULL
+      if (!$label = entity_label($entity_type, $entity))
+        $label = $entity_id;

@@ -1203,10 +1207,12 @@ function views_bulk_operations_direct_process($operation, $rows, $options) {
+        if (!$label = entity_label($entity_type, $entity))
+          $label = $id;

This formatting needs to be updated to meet coding standards and couldn't it just be.
$label = entity_label($entity_type, $entity) ? $id;

Generally, I wonder if there some precident for this in other modules because I recall seeing "Entity ID #" suffix or something like that in other places.

dhansen’s picture

Status: Needs work » Needs review
FileSize
2.27 KB

Updated the patch. Made changes so the conditionals should now adhere to the coding standards (have brackets in place now).

I would absolutely love to use the ternary shorthand ?: on this, but that was introduced in PHP 5.3 and the last reported PHP version support was for 5.2.9, so no go.

I did a quick search for established entity_label() fallbacks but did not come up with anything. Happy to implement if you come across one.