You are here

function file_entity_field_extra_fields in File Entity (fieldable files) 7

Same name and namespace in other branches
  1. 7.3 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 242
Extends Drupal file entities to be fieldable and viewable.

Code

function file_entity_field_extra_fields() {
  $return = array();
  $info = entity_get_info('file');
  foreach (array_keys($info['bundles']) as $bundle) {
    $return['file'][$bundle] = array(
      'form' => array(
        'file' => array(
          'label' => t('File'),
          'description' => t('File preview'),
          'weight' => 0,
        ),
      ),
      'display' => array(
        'file' => array(
          'label' => t('File'),
          'description' => t('File display'),
          'weight' => 0,
        ),
      ),
    );
  }
  return $return;
}