From 32c93556c0bb40cf3ad8a7759f4812502c5727d7 Mon Sep 17 00:00:00 2001 From: Dreytac Date: Fri, 17 Apr 2026 02:57:35 +1000 Subject: [PATCH] Create options and hook to load Font Awesome assets. --- index.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/index.php b/index.php index 58e544b..4a0c50b 100644 --- a/index.php +++ b/index.php @@ -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.bootstrap.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", ], );