You are here

function _views_bulk_operations_fields_action_token in Views Bulk Operations (VBO) 6

1 call to _views_bulk_operations_fields_action_token()
views_bulk_operations_fields_action in actions/fields.action.inc
Action function.

File

actions/fields.action.inc, line 591
Drupal action to set individual field values.

Code

function _views_bulk_operations_fields_action_token($value, $node, $field, $delta = NULL) {
  if (module_exists('token')) {
    if (isset($delta) && isset($field['columns']) && is_array($value)) {
      foreach (array_keys($field['columns']) as $column) {
        if (isset($value[$column])) {
          $value[$column] = token_replace($value[$column], 'node', $node);
        }
      }
    }
    else {
      if (is_array($value)) {
        foreach ($value as $v_delta => $v_item) {
          if (is_array($v_item) && isset($field['columns'])) {
            foreach (array_keys($field['columns']) as $column) {
              if (isset($v_item[$column])) {
                $value[$v_delta][$column] = token_replace($v_item[$column], 'node', $node);
              }
            }
          }
          else {
            $value[$v_delta] = token_replace($v_item, 'node', $node);
          }
        }
      }
      else {
        $value = token_replace($value, 'node', $node);
      }
    }
  }
  return $value;
}