You are here

function _support_upload_field in Support Ticketing System 7

2 calls to _support_upload_field()
_support_save_attachments in ./support.module
_support_upload_field_name in ./support.module

File

./support.module, line 1755
support.module

Code

function _support_upload_field($entity_type = 'node', $bundle = 'empty') {
  if ($entity_type == 'node') {
    $bundle = 'support_ticket';
  }
  elseif ($entity_type == 'comment') {
    $bundle = 'comment_node_support_ticket';
  }
  $field_name = variable_get('support_mail_upload_field', 'support_ticket_upload');
  $info = field_info_field($field_name);
  if ($info && isset($info['bundles'][$entity_type]) && in_array($bundle, $info['bundles'][$entity_type])) {
    $info['instance'] = field_info_instance($entity_type, $field_name, $bundle);
    return $info;
  }

  // Try the upload field as well.
  $info = field_info_field('upload');
  if ($info && isset($info['bundles'][$entity_type]) && in_array($bundle, $info['bundles'][$entity_type])) {
    $info['instance'] = field_info_instance($entity_type, $field_name, $bundle);
    return $info;
  }
}