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分鐘 |
此插件是“原樣”提供的,無法保證。在您自己的風險中使用它,並始終在生產環境中使用它之前對其進行測試。如果發現任何問題,請創建一個新問題。
麻省理工學院
不願在任何促進種族主義,性別歧視,同性戀恐懼症,虐待動物,暴力或任何其他形式的仇恨言論的項目中使用此插件。