You are here

function _views_bulk_operations_normalize_comment_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_comment_context()

Normalize function for comment context.

See also

_trigger_normalize_comment_context()

1 string reference to '_views_bulk_operations_normalize_comment_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 1044
Allows operations to be performed on items selected in a view.

Code

function _views_bulk_operations_normalize_comment_context($type, $comment) {
  switch ($type) {

    // An action that works with nodes is being called in a comment context.
    case 'node':
      return node_load(is_array($comment) ? $comment['nid'] : $comment->nid);

    // An action that works on users is being called in a comment context.
    case 'user':
      return user_load(array(
        'uid' => is_array($comment) ? $comment['uid'] : $comment->uid,
      ));
  }
}