1.20.x file.module file_field_extra_fields()

Implements hook_field_extra_fields().

Adds 'file' as an extra field, so that its display and form component can be weighted relative to the fields that are added to file entity bundles.

File

modules/file/file.module, line 550
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function file_field_extra_fields() {
  $info = array();

  if ($file_type_names = file_type_get_names()) {
    foreach ($file_type_names as $type => $name) {
      $info['file'][$type]['form']['filename'] = array(
        'label' => t('Name'),
        'description' => t('Name'),
        'weight' => -10,
      );
      $info['file'][$type]['form']['preview'] = array(
        'label' => t('File'),
        'description' => t('File preview'),
        'weight' => -5,
      );
      $info['file'][$type]['display']['file'] = array(
        'label' => t('File'),
        'description' => t('File display'),
        'weight' => 0,
      );
    }
  }

  return $info;
}