tobimori/kirby-icon-field
Composer 安装命令:
composer require tobimori/kirby-icon-field
包简介
A simple Icon field plugin for Kirby CMS
关键字:
README 文档
README
Kirby Icon Field
A simple Icon field for Kirby 4+ - throw your Icon pack in a folder, add the field to your blueprints and you're good to go.
If you're using Kirby 3.9+, please try using v1.0.3.
Installation
Recommended: Composer
composer require tobimori/kirby-icon-field
Manual installation
Download and copy this repository to /site/plugins/kirby-icon-field, or apply this repository as Git submodule.
Usage
This plugin relies on having your SVG icons as separate files in a folder for display in the panel - of course you're free to do whatever you want with the field's value in your templates.
Icons will always be displayed in single-color white or black.
Add the field to your blueprint:
fields: icon: label: Icon type: icon folder: assets/icons # path to your icon folder, relative to the `index` kirby root (you can use the Kirby query language) max: 1 # max number of icons to select - 1 will look like a 'select field', none or more like a 'multiselect' field sprite: svg-sprite.svg # optional, path to your svg sprite relative to folder option, if you want to use a sprite instead of individual files (you can use the Kirby query language) # [more settings...] - same as multi-select field, e.g. disabling search, limiting icons, etc.
Note
If you're using a sprite, make sure the file is available for the user to access at the set path. The plugin does not copy or move the file, it only references it. The #id reference will be stored without a .svg extension unlike the individual files mode.
Use the field value in your template
<?= svg('/assets/icons/' . $page->icon()) ?>
Options
| Option | Default | Description |
|---|---|---|
cache |
true |
Enable cache for reading from icons directory |
folder |
assets/icons |
Default folder for icon field, can also be a function |
sprite |
null |
Default file for SVG sprite file, can also be a function |
Options allow you to fine tune the behaviour of the plugin. You can set them in your config.php file:
return [ 'tobimori.icon-field' => [ 'cache' => true, 'folder' => 'assets/icons' ], ];
Support
Note
This plugin is provided free of charge & published under the permissive MIT License. If you use it in a commercial project, please consider to sponsor me on GitHub to support further development and continued maintenance of Kirby Icon Field.
License
MIT License Copyright © 2023-2024 Tobias Möritz
The icons in the preview image are part of Chunk Icons by Noah Jacobus. <3
tobimori/kirby-icon-field 适用场景与选型建议
tobimori/kirby-icon-field 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 21.03k 次下载、GitHub Stars 达 52, 最近一次更新时间为 2023 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「kirby」 「kirby-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tobimori/kirby-icon-field 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tobimori/kirby-icon-field 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tobimori/kirby-icon-field 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Zero-dependency global `kirbylog()` helper for any content
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Blade template for Kirby
Search Kirby with Loupe
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
X-Ray provides a comprehensive overview of the content present on your site and individual pages, allowing you to inspect and evaluate them at a glance.
统计信息
- 总下载量: 21.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 52
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-15