You are here

function file_entity_field_extra_fields in File Entity (fieldable files) 7.3

Same name and namespace in other branches
  1. 7 file_entity.module \file_entity_field_extra_fields()
  2. 7.2 file_entity.module \file_entity_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

./file_entity.module, line 1094
Extends Drupal file entities to be fieldable and viewable.

Code

function file_entity_field_extra_fields() {
  $info = array();
  if ($file_type_names = file_entity_type_get_names()) {
    foreach ($file_type_names as $type => $name) {
      $info['file'][$type]['form']['filename'] = array(
        'label' => t('File name'),
        'description' => t('File 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;
}