function file_entity_field_formatter_info_alter in File Entity (fieldable files) 8.2
Same name and namespace in other branches
- 7.3 file_entity.field.inc \file_entity_field_formatter_info_alter()
- 7.2 file_entity.field.inc \file_entity_field_formatter_info_alter()
Implements hook_field_formatter_info_alter().
File
- ./
file_entity.module, line 98 - Extends Drupal file entities to be fieldable and viewable.
Code
function file_entity_field_formatter_info_alter(array &$info) {
// Make the entity reference view formatter available for files and images.
if (!empty($info['entity_reference_entity_view'])) {
$info['entity_reference_entity_view']['field_types'][] = 'file';
$info['entity_reference_entity_view']['field_types'][] = 'image';
}
// Add descriptions to core formatters.
$descriptions = array(
'file_default' => t('Create a simple link to the file. The link is prefixed by a file type icon and the name of the file is used as the link text.'),
'file_table' => t('Build a two-column table where the first column contains a generic link to the file and the second column displays the size of the file.'),
'file_url_plain' => t('Display a plain text URL to the file.'),
'image' => t('Format the file as an image. The image can be displayed using an image style and can optionally be linked to the image file itself or its parent content.'),
);
foreach ($descriptions as $key => $description) {
if (isset($info[$key]) && empty($info[$key]['description'])) {
$info[$key]['description'] = $description;
}
}
}