blueways/bw-icons
Composer 安装命令:
composer require blueways/bw-icons
包简介
TYPO3-Extension that adds a icon form element
关键字:
README 文档
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!
Install
Composer
composer require blueways/bw-icons
TER
Download the zip file from TYPO3 extension repository (TER).
Setup
-
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: 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
iconSelectionin 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.
License
This project is licensed under GNU General Public License 2.0 (or later).
Contribute
This extension was made by Maik Schneider: Feel free to contribute!
blueways/bw-icons 适用场景与选型建议
blueways/bw-icons 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 96.26k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2021 年 08 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「extension」 「icons」 「typo3」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 blueways/bw-icons 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 blueways/bw-icons 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 blueways/bw-icons 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
Set Links with a specific language parameter
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
A simple library of SVG page type icons for enhancing your SilverStripe CMS interface.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
UI Kit 3 Extension for Yii2
统计信息
- 总下载量: 96.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 20
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2021-08-23