views_bulk_operations.module, line 821, code states:

/**
 * Implementation of hook_views_bulk_operations_object_info()
 *
 * Hook used by VBO to be able to handle different objects as does Views 2 and the Drupal core action system.
 *
 * The array returned for each object type contains:
 *  'type' (required) => the object type name, should be the same as 'type' field in hook_action_info().
 *  'context' (optional) => the context name that should receive the object, defaults to the value of 'type' above.

Context does not default to the value of 'type' as stated (so actually, 'context' is required too). Because of this, it is sometimes empty.
This sometimes leads to an empty key in the context array, e.g.

[] => stdClass Object
(
  [nid] => 1234
  [...]
)

instead of

[node] => stdClass Object
(
  [nid] => 1234
  [...]
)
CommentFileSizeAuthor
#2 context_default_to_type-1247372-2.patch529 bytesanrikun

Comments

anrikun’s picture

Title: Context might not be properly initialized » Context does not default to type as stated in hook_views_bulk_operations_object_info()
anrikun’s picture

Status: Active » Needs review
StatusFileSize
new529 bytes

This simple patch should do the trick! (It works for me)

infojunkie’s picture

Status: Needs review » Fixed

Thanks for the patch. Committed to latest dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.