You are here

function commerce_file_field_formatter_info_alter in Commerce File 7

Implements hook_field_formatter_info_alter().

  • Add field type to other supported formatters

File

includes/commerce_file.field.inc, line 73
Implement an commerce_file field, based on the file module's file field.

Code

function commerce_file_field_formatter_info_alter(&$info) {
  foreach ($info as $formatter_type => &$formatter_info) {
    if (empty($formatter_info['field types'])) {
      continue;
    }

    // Add to all file formatters
    if (in_array('file', $formatter_info['field types']) && !in_array(COMMERCE_FILE_FIELD_TYPE, $formatter_info['field types'])) {
      $formatter_info['field types'][] = COMMERCE_FILE_FIELD_TYPE;
    }
  }
  unset($formatter_info);
}