Use CSS for file icons in file fields

Created on 9 April 2014, over 10 years ago
Updated 12 September 2023, over 1 year ago

Problem/Motivation

file fields prints out a seperate image file as an icon

<span class="file">
<img class="file-icon" alt="" title="text/plain" src="/core/modules/file/icons/text-plain.png"> 
<a href="http://drupal8.dev/sites/default/files/files/interdiff-field-117-121_0.txt" type="text/plain; length=3264">interdiff-field-117-121.txt</a></span>

No reason for that exatra http request everytime when it can be done in css & will be easier to modify for the themer

Proposed resolution

<a href="http://drupal8.dev/sites/default/files/files/interdiff-field-117-121_0.txt" type="text/plain; length=3264" class="file-icon-text">interdiff-field-117-121.txt</a>

css:

file-icon-text{
  background: url(icont-text-something.gif) no-repeat;
}

Remaining tasks

User interface changes

API changes

📌 Task
Status

Fixed

Version

8.0 ⚰️

Component
Field 

Last updated about 7 hours ago

Created by

🇩🇰Denmark mortendk

Live updates comments and jobs are added and updated live.
  • CSS

    It involves the content or handling of Cascading Style Sheets.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024