blueways / bw-icons
TYPO3-Extension that adds a icon form element
Installs: 47 906
Dependents: 4
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 2
Open Issues: 19
Type:typo3-cms-extension
Requires
- php: ^8.0
- ext-dom: *
- ext-json: *
- ext-libxml: *
- ext-simplexml: *
- phenx/php-font-lib: 0.5.4 || 0.5.6
- sabberworm/php-css-parser: 8.4.0
- typo3/cms-core: ^12.4
Requires (Dev)
- bk2k/bootstrap-package: dev-master
- clue/phar-composer: ^1.0
- friendsofphp/php-cs-fixer: ^3.12
- phpmd/phpmd: ^2.13.0
- saschaegerer/phpstan-typo3: ^1.8
- typo3/cms-backend: ^12.0
- typo3/cms-belog: ^12.0
- typo3/cms-beuser: ^12.0
- typo3/cms-dashboard: ^12.0
- typo3/cms-extbase: ^12.0
- typo3/cms-extensionmanager: ^12.0
- typo3/cms-felogin: ^12.0
- typo3/cms-filelist: ^12.0
- typo3/cms-fluid: ^12.0
- typo3/cms-fluid-styled-content: ^12.0
- typo3/cms-form: ^12.0
- typo3/cms-frontend: ^12.0
- typo3/cms-impexp: ^12.0
- typo3/cms-indexed-search: ^12.0
- typo3/cms-info: ^12.0
- typo3/cms-install: ^12.0
- typo3/cms-linkvalidator: ^12.0
- typo3/cms-lowlevel: ^12.0
- typo3/cms-opendocs: ^12.0
- typo3/cms-redirects: ^12.0
- typo3/cms-reports: ^12.0
- typo3/cms-rte-ckeditor: ^12.0
- typo3/cms-scheduler: ^12.0
- typo3/cms-seo: ^12.0
- typo3/cms-setup: ^12.0
- typo3/cms-tstemplate: ^12.0
- typo3/testing-framework: ^8.0
- dev-main
- dev-development
- 3.1.1
- 3.1.0
- 3.0.1
- 3.0.0
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.4.0
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- v0.9.0
- dev-renovate/node-dependencies
- dev-renovate/lock-file-maintenance
- dev-renovate/sabberworm-php-css-parser-8.x
- dev-renovate/major-typo3
- dev-renovate/major-node-dependencies
- dev-renovate/typo3-testing-framework-9.x
- dev-renovate/phenx-php-font-lib-1.x
- dev-v13-compatibility
- dev-patch-1
- dev-master
- dev-12.x-dev
- dev-feature/phpunit
- dev-renovate/configure
- dev-release-2.1.6
- dev-backend-url-prefix
- dev-feature/image-accessibility
- dev-prevent-copy
- dev-fix-access
- dev-feature/quality-tools
- dev-feature/v12
This package is auto-updated.
Last update: 2024-11-02 11:21:02 UTC
README
TYPO3 extension bw_icons
Icon picker for TCA and RTE. Generates a browsable gallery of your icon fonts and SVGs - just link your stylesheet or image directory. Works with FontAwesome, Bootstrap, Icomoon.. Optionally adds icon field to pages, tt_content or sys_category.
Demo
Features
- icon picker form element
- icon field for tt_content, pages and sys_category
- RTE plugin
- icon gallery with filter function
- displays icons from image files or font (css)
- extracts and caches font styles (css)
- works with remote css files
- can include generated stylesheet in the frontend
Pro tip: Use your Icomoon development file. Your Icon Picker is always up to date, and you can serve the font files from your own remote without manually downloading and adjusting paths!
Installation
-
Install via composer
composer require blueways/bw-icons
-
Update database schema
-
Include PageTS
Enable the extension in the Extension Manager and include the static PageTS for TYPO3 core icons or set up your own icons. See Configuration section.
-
Enable icons for tt_content, pages and/or sys_category
In the extension settings (
Admin Tools → Extension Configuration → bw_icons
), you can enable the icon fields. If you want to use it for other tables, see For developers section. -
Include RTE configuration (optional)
imports: - { resource: EXT:bw_icons/Configuration/RTE/IconPicker.yaml } editor: config: toolbar: - { name: 'icon', items: [IconPicker] }
Configuration
The displayed icons are set up via PageTS. Choose a unique identifier and
select FileIconProvider
if you want to add
image files from a directory or CssIconProvider
if you want to display font
icons from a stylesheet.
mod.tx_bwicons {
# Get icons from directory and subdirectory. Subdirectories become sidebar links.
typo3icons = Blueways\BwIcons\Provider\FileIconProvider
typo3icons {
title = TYPO3 Icons
folder = EXT:core/Resources/Public/Icons/T3Icons/svgs
}
# Get icons from stylesheet. Multiple font-faces in one file become sidebar links.
fontawesome = Blueways\BwIcons\Provider\CssIconProvider
fontawesome {
title = FontAwsome
file = fileadmin/fontawesome/css/all.css
}
# Get icons from remote stylesheet. Styles and font files are cached in /typo3temp
icomoon = Blueways\BwIcons\Provider\CssIconProvider
icomoon {
title = Icomoon
file = https://i.icomoon.io/public/b23ec64zea/Project/style.css
# optional: adjust markup in backend wizard
# defaults to <i class="###ICON###"></i>
markup = <span class="my-custom-class ###ICON###"></span>
}
}
After changing the settings, make sure to clear the cache.
RTE Configuration
After importing the yaml configuration, you can add the new button anywhere you want to your RTE present. Read more about RTE configuration.
imports: - { resource: EXT:bw_icons/Configuration/RTE/IconPicker.yaml } editor: config: toolbar: - { name: 'icon', items: [ IconPicker ] }
Usage
The icons are saved as filename (
e.g. EXT:myext/Resources/Public/Images/icon.svg
or fileadmin/icons/foo.png
)
if you use the FileIconProvider
or as css class names (
e.g. fas fa-arrow-right
) by using CssIconProvider
.
If you have configured only the selection of SVGs, you can safely use
the <f:image src="{data.tx_bwicons_icon}" />
viewHelper in your fluid
template.
By only using font icons, you can output
like <i class="{data.tx_bwicons_icon}"></i>
.
If you have a mixture, you can use my ViewHelper that determines the type by checking for a dot in the icon name:
{namespace bw=Blueways\BwIcons\ViewHelpers} <bw:icon icon="{data.tx_bwicons_icon}" /> Hello world!
Output:
<i class="fa fas-wave"></i> Hello world!
or
<img src="/fileadmin/icons/foo.svg" /> Hello world!
CSS Frontend Include
If you want to include the extracted styles in the frontend, you can use
the CssUtility
to generate the style-tags in the head of your page. Include
this in your TypoScript setup:
page.headerData {
123 = USER
123.userFunc = Blueways\BwIcons\Utility\CssUtility->includeStyleSheets
}
For developers
Usage in other tables
-
Create database field for the icon:
create table tx_myext_domain_model_foo ( icon_field varchar(255) not null default '', );
-
Edit TCA: Add the renderType
iconSelection
in the config array:... 'icon_field' => [ 'label' => 'My Icon', 'config' => [ 'type' => 'input', 'renderType' => 'iconSelection' ] ], ...
Optional: you may restrict which icon providers are available:
... 'icon_field' => [ 'label' => 'My Icon', 'config' => [ 'type' => 'input', 'renderType' => 'iconSelection', 'iconProviders' => 'fontawesome,otherProviderKey' ] ], ...
New icon sources
If you want to add other icon sources (e.g. from API), you can create your own
IconProvider. Just make sure to extend
from Blueways\BwIcons\Provider\AbstractIconProvider
.
Contribute
This extension was made by Maik Schneider: Feel free to contribute!