diff --git a/core/modules/file/css/file.formatter.generic.css b/core/modules/file/css/file.formatter.generic.css index 73498e3..8997487 100644 --- a/core/modules/file/css/file.formatter.generic.css +++ b/core/modules/file/css/file.formatter.generic.css @@ -20,45 +20,48 @@ background-position: right center; } -.file.package-x-generic { +.file.file--general { + background-image: url(../icons/application-octet-stream.png); +} +.file.file--package-x-generic { background-image: url(../icons/package-x-generic.png); } -.file.office-spreadsheet { +.file.file--x-office-spreadsheet { background-image: url(../icons/x-office-spreadsheet.png); } -.file.office-document { +.file.file--x-office-document { background-image: url(../icons/x-office-document.png); } -.file.office-presentation { +.file.file--x-office-presentation { background-image: url(../icons/x-office-presentation.png); } -.file.text-x-script { +.file.file--text-x-script { background-image: url(../icons/text-x-script.png); } -.file.text-html { +.file.file--text-html { background-image: url(../icons/text-html.png); } -.file.text-plain { +.file.file--text-plain { background-image: url(../icons/text-plain.png); } -.file.application-pdf { +.file.file--application-pdf { background-image: url(../icons/application-pdf.png); } -.file.application-octet-stream { +.file.file--application-octet-stream { background-image: url(../icons/application-octet-stream.png); } -.file.application-x-executable { +.file.file--application-x-executable { background-image: url(../icons/application-x-executable.png); } -.file.audio { +.file.file--audio { background-image: url(../icons/audio-x-generic.png); } -.file.video { +.file.file--video { background-image: url(../icons/video-x-generic.png); } -.file.text { +.file.file--text { background-image: url(../icons/text-x-generic.png); } -.file.image { +.file.file--image { background-image: url(../icons/image-x-generic.png); } diff --git a/core/modules/file/file.module b/core/modules/file/file.module index c11d392..c1dc1c6 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1564,7 +1564,9 @@ function template_preprocess_file_link(&$variables) { // Classes to add to the file field for icons. $classes = array( 'file', - strtr($mime_type, array('/' => '-')), + // Add a specific class for each and every mime type. + 'file--mime-' . strtr($mime_type, array('/' => '-', '.' => '-')), + // Add a more general class for groups of well known mime types. 'file--' . file_icon_class($mime_type), ); @@ -1599,7 +1601,7 @@ function file_icon_class($mime_type) { } // If there's no generic icon for the type the general class. - return 'file--general'; + return 'general'; } /** @@ -1723,6 +1725,14 @@ function file_icon_map($mime_type) { case 'application/x-pef-executable': return 'application-x-executable'; + // Acrobat types + case 'application/pdf': + case 'application/x-pdf': + case 'applications/vnd.pdf': + case 'text/pdf': + case 'text/x-pdf': + return 'application-pdf'; + default: return FALSE; }