Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dean-forest-tech/silverstripe-file-icons
Add a configurable icon string to file objects that can be used to automatically generate CSS classes (defaults to FontAwesome)
https://github.com/dean-forest-tech/silverstripe-file-icons
Last synced: 5 days ago
JSON representation
Add a configurable icon string to file objects that can be used to automatically generate CSS classes (defaults to FontAwesome)
- Host: GitHub
- URL: https://github.com/dean-forest-tech/silverstripe-file-icons
- Owner: Dean-Forest-Tech
- License: bsd-3-clause
- Created: 2024-05-02T15:18:26.000Z (8 months ago)
- Default Branch: 1
- Last Pushed: 2024-05-02T20:42:19.000Z (8 months ago)
- Last Synced: 2024-12-10T00:57:47.969Z (about 1 month ago)
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- Contributing: contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# SilverStripe File Icons
Attempt to generate an icon string based on the extension of a file.
By default, this returns a relevent FontAwesome icon class.
NOTE: This module does not install any icon libraries, it only allows you to more easily assign an icon to files in your themes.
## Install
Install via composer:
composer require "dft/silverstripe-file-icons"
## Usage
Once installed, you can add use the following in your templates:
$File.IconClasses
For example, if you wanted to generate a bootstrap button with FontAwesome icon, you could use:
<% with $File %>
Download {$Title}
<% end_with %>## Changing Icons
All icons are mapped via YML config (_config/fileicons.yml), you can map custom classes by overwriting the default config provided by this module.