Create options and hook to load Font Awesome assets.

This commit is contained in:
2026-04-17 02:57:35 +10:00
parent e1205aa521
commit 892dde104a

View File

@@ -14,6 +14,35 @@
Kirby::plugin(
name: "hobbyhome/fontawesome",
extends: [
"options" => [
"assets" => [
"css" => [
150 => Url::path(kirby()->url("media") . "/plugins/hobbyhome/fontawesome/css/fontawesome" . r(!option("debug"), ".min") . ".css", true),
151 => Url::path(kirby()->url("media") . "/plugins/hobbyhome/fontawesome/css/regular" . r(!option("debug"), ".min") . ".css", true),
152 => Url::path(kirby()->url("media") . "/plugins/hobbyhome/fontawesome/css/solid" . r(!option("debug"), ".min") . ".css", true),
153 => Url::path(kirby()->url("media") . "/plugins/hobbyhome/fontawesome/css/brands" . r(!option("debug"), ".min") . ".css", true),
],
],
],
"hooks" => [
/**
* To add this hook to a plugin, change the option() call to use the plugins name.
*
* @version 1.0
*/
"hobbyhome.getAssets" => function ($files = [], $type = "css") {
foreach (option("hobbyhome.fontawesome.assets.{$type}", []) as $order => $file) {
# Make sure no other file exists with the current sort order index.
while (isset($files[$order])) {
$order++;
}
$files[$order] = $file;
}
return $files;
},
],
],
info: [
"authors" => [[
@@ -23,5 +52,6 @@ Kirby::plugin(
]],
"license" => "AGPL-3.0-only",
"version" => "0.0.0",
# "bootstrap" => "7.2.0",
],
);