You are here

function _views_bulk_operations_normalize_user_context in Views Bulk Operations (VBO) 6

Same name and namespace in other branches
  1. 6.3 views_bulk_operations.module \_views_bulk_operations_normalize_user_context()

Normalize function for user context.

See also

_trigger_normalize_user_context()

1 string reference to '_views_bulk_operations_normalize_user_context'
views_bulk_operations_views_bulk_operations_object_info in ./views_bulk_operations.module
Implementation of hook_views_bulk_operations_object_info()

File

./views_bulk_operations.module, line 1061
Allows operations to be performed on items selected in a view.

Code

function _views_bulk_operations_normalize_user_context($type, $account) {
  switch ($type) {

    // If an action that works on comments is being called in a user context,
    // the action is expecting a comment object. But we have no way of
    // determining the appropriate comment object to pass. So comment
    // actions in a user context are not supported.
    // An action that works with nodes is being called in a user context.
    // If a single node is being viewed, return the node.
    case 'node':

      // If we are viewing an individual node, return the node.
      if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == NULL) {
        return node_load(array(
          'nid' => arg(1),
        ));
      }
  }
}