定制 plasticstudio/iconfield 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

plasticstudio/iconfield

Composer 安装命令:

composer require plasticstudio/iconfield

包简介

Icon field for Silverstripe - forked from jaedb/iconfield

关键字:

README 文档

README

composer require plasticstudio/iconfield

Description

Provides a visual icon picker for content authors. Icon files are managable via the asset library.

IconField

Requirements

  • SilverStripe 4, 5 or 6

Version

  • Use release 1 for legacy non-cms editable icon files
  • Use release 2 for Silverstripe 5 with updated icon files managed in CMS Files area
  • Use release 3 for Silverstripe 6

Migration

If migrating from release 1 to 2/3:

PlasticStudio\IconField\IconField:
  icons_folder_name: SiteIcons
  • upgrade to v2/3
  • create new folders in CMS Files area based on IconField set up, eg SiteIcons (or reload cms page with iconfield to create). Can have nested folders inside SiteIcons.
  • upload and publish icons
  • update IconFields to use new source path, eg IconField::create('SocialIcon', 'Icon', 'SiteIcons'). You should see relevant icons display in iconfield.
  • to update database and relink selected icon: run task IconFieldPathMigrator_BuildTask for each class that has been updated
  • make sure to add params ?classname=Skeletor\DataObjects\SummaryPanel&field=SVGIcon
  • if your new folder is not 'SiteIcons', add this to the params as well, eg &new-path=NewFolder
  • lastly, remove the icon folder from client/assets

Usage

  • Import the required classes:
use PlasticStudio\IconField\Icon;
use PlasticStudio\IconField\IconField;
  • Add folder name to _config.yml
PlasticStudio\IconField\IconField:
  icons_folder_name: SiteIcons
  • Set your $db field to type Icon (eg 'PageIcon' => Icon::class)

  • IconField::create($name, $title, $folderName)

    • $name is the database field as defined in your class
    • $title is the label for this field
    • $folderName is the name of the folder inside the Assets eg 'SiteIcons', nested folders are allowed eg 'SiteIcons/ProductIcons'
  • Use your icon in templates as you would any other property (eg $PageIcon). If your icon is an SVG, the SVG image data will be injected into the template. To prevent this, you can call $PageIcon.IMG instead to enforce use of <img> tags.

  • Add a default width and height to the config.yml file to output width/height attributes on image tags, e.g. <img width="30" height="30" />. This is good for SEO.

PlasticStudio\IconField\IconField:
  default_width: "30"
  default_height: "30"

统计信息

  • 总下载量: 15.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2021-03-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固