diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 69fcbf3..5d9f620 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1286,9 +1286,9 @@ function theme_file_icon($variables) { $file = $variables['file']; $icon_directory = $variables['icon_directory']; - $mime = check_plain($file->filemime); + $title = !empty($file->filename) ? check_plain($file->filename) : check_plain($file->filemime); $icon_url = file_icon_url($file, $icon_directory); - return ''; + return ''; } /** diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php index 81e87d0..086db71 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php @@ -62,6 +62,10 @@ function testNodeDisplay() { $node = node_load($nid, TRUE); $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']); $default_output = theme('file_link', array('file' => $node_file)); + + $this->assertRaw('title="' . $node_file->filename . '"', t('Theme icon includes title attribute correctly')); + $this->assertRaw('type="' . $node_file->filemime . '; length=' . $node_file->filesize . '"', t('File link includes type attribute correctly')); + $this->assertRaw('href="' . file_create_url($node_file->uri) .'"', t('File link includes href attribute correctly')); $this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.')); // Turn the "display" option off and check that the file is no longer displayed.