Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am using the FileField paths module. It adds a field called 'origname' and Filefield paths allows me to change the file name and paths. I successfully added that field to the display in a custom module (even for a drupal coding noob pretty easy):
function mymodulename_extended_file_field_metadata_types() {
// Start with the default file field metadata.
$defaults = array(
'origname' => array(
'title' => t('File Name'),
'sort' => 'string',
),
);
return $defaults;
}
Now I would like to remove the default file display and link. The user will not be able to download these uploaded files and I only want them to see the file name that they uploaded.
Comments
Comment #1
jthorson CreditAttribution: jthorson as a volunteer commentedHopefully you figured this out ... but in case others following have the same question, one approach to do this would be to implement hook_extended_file_field_output_alter(&$elements, &$context). This hook allows you to modify the final table structure prior to rendering the final extended_file_field formatter output; and allows for everything from adding or hiding particular items to re-structuring the entire output table.
An example implementation and documentation for the function can be found inside extended_file_field.api.php.