How to link the file icon to the file and to hide the filename? I have uploaded files to be displayed in a table together with some other informations (title, tags etc). One row of this table the filename which links to the downloadable file. Next to the filename a file icon is displayed be daefault, which isn't linked.

That's how it looks now:



I want the filename to be hidden and the file icon linked to the downloadable file.

What functions would I have to override to make that happen? Or what other way may exist?
The problem with generic file display is that icon is not linkable, therefor a CSS solution is useless.

So in order to make the icon linkable you need to create another file display formate or alter theme_file_link 

My solution is to add additional display formate, code as follow:

/**
 * Implements hook_field_formatter_info().
 */
function mymodule_field_formatter_info() {
  return array(
    'mymodule_link_icon' =&gt; array(
      'label' =&gt; t('Linkable icon'),
      'field types' =&gt; array('file'),
    ),
  );
}

/**
 * Implements hook_field_formatter_view().
 */
function mymodule_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();

  switch ($display['type']) {

    case 'mymodule_link_icon':

      foreach ($items as $delta =&gt; $item) {

        $file = (object) $item;

        $url = file_create_url($file-&gt;uri);

        $icon_directory = variable_get('file_icon_directory', drupal_get_path('module', 'file') . '/icons');

        $icon = theme('file_icon', array('file' =&gt; $file, 'icon_directory' =&gt; $icon_directory));

        $options['attributes']['title'] = check_plain($file-&gt;filename);

        $options['html'] = TRUE;

        $link_icon = '&lt;span class="file"&gt;' . l($icon, $url, $options) . '&lt;/span&gt;';


        $element[$delta] = $element[$delta] = array('#markup' =&gt; $link_icon);
      }

      break;
  }

  return $element;
}


After you implement the above code in a module and enable it, make sure to change field formatter option in your view to Linkable icon