hailwood/silverstripe-fontawesome

此包已被废弃且不再维护。未建议替代包。

添加新的图标选择器字段类型。

安装: 25

依赖: 0

建议者: 0

安全: 0

星标: 2

关注者: 1

分支: 2

开放问题: 2

类型:silverstripe-module

1.0.0 2017-01-09 08:23 UTC

This package is not auto-updated.

Last update: 2020-01-24 16:47:11 UTC


README

一个 Silverstripe Font Awesome 图标选择器

Screenshot

  • 始终更新最新版本:我们从 Font Awesome 仓库读取 yaml 文件。只需指定版本,即可使用。
  • 前端可选:我们知道在前端您可能希望捆绑自己的 Font Awesome 图标,因此您可以选择是否要从 CDN 加载。

选项

FontAwesomeIconField:
  version: 4.6.3
  autoload_css: true

用法

Dataobject/Page
class PageWithIcon extends Page {

    protected static $db = [
        'PageIcon' => 'FontAwesomeIcon',
    ];
    
    public function getCMSFields(){
        $fields = parent::getCMSFields();
        
        $fields->addFieldToTab('Root.Main', FontAwesomeIconField::create('PageIcon', 'Icon'));
        
        return $fields;
    }

} 
SS 模板(如果您要添加其他类)
<div>
<strong>Page Icon:</strong> <i class="{$PageIcon.Classes} some-other-class"></i>
</div>
SS 模板(如果您不想自定义它)
<div>
<strong>Page Icon:</strong> {$PageIcon}
</div>