kirby3 fontselector
v1.2.0
Kirby插件可选择字体family和Font重量,并带有两个同步字段
site/plugins/kirby3-fontselector或git submodule add https://github.com/bnomei/kirby3-fontselector.git site/plugins/kirby3-fontselector或composer require bnomei/kirby3-fontselector 设置要与配置值一起使用的字体。您可以使用自定义JSON文件或返回PHP数组。
资产/fonts.json
{
"fonts" : [
{
"font" : " Merriweather " ,
"weight" : [
600 ,
700
]
},
{
"font" : " Montserrat " ,
"weight" : [
300 ,
400 ,
500
]
}
]
} <?php
return [
' bnomei.fontselector.fonts ' => function () {
return Json:: read ( kirby ()-> roots ()-> assets () . ' /fonts.json ' );
// return ['fonts' => [...]];
},
// other options
];将字段添加到您的页面蓝图中。
site/blueprints/default.yml
fields :
headlinefont :
type : fontfamily
default : Merriweather
required : true
# reload: true # optional reload on save
headlineh1weight :
type : fontweight
watchField : headlinefont
default : 700
required : true
headlineh2weight :
type : fontweight
watchField : headlinefont
default : 600
required : true
copytextfont :
type : fontfamily
default : Montserrat
required : true
copytextweight :
type : fontweight
watchField : copytextfont
default : 400
required : true 警告
默认情况下,该插件具有1分钟的缓存。
| Bnomei.FontSelector。 | 默认 | 描述 |
|---|---|---|
| 字体 | function(){...} | 回调以返回字体数组 |
| 到期 | 1 | 缓存将到期n分钟 |
此插件是“原样”提供的,无法保证。在您自己的风险中使用它,并始终在生产环境中使用它之前对其进行测试。如果发现任何问题,请创建一个新问题。
麻省理工学院
不愿在任何促进种族主义,性别歧视,同性恋恐惧症,虐待动物,暴力或任何其他形式的仇恨言论的项目中使用此插件。