Create options and hook to load Font Awesome assets.
This commit is contained in:
30
index.php
30
index.php
@@ -14,6 +14,35 @@
|
|||||||
Kirby::plugin(
|
Kirby::plugin(
|
||||||
name: "hobbyhome/fontawesome",
|
name: "hobbyhome/fontawesome",
|
||||||
extends: [
|
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: [
|
info: [
|
||||||
"authors" => [[
|
"authors" => [[
|
||||||
@@ -23,5 +52,6 @@ Kirby::plugin(
|
|||||||
]],
|
]],
|
||||||
"license" => "AGPL-3.0-only",
|
"license" => "AGPL-3.0-only",
|
||||||
"version" => "0.0.0",
|
"version" => "0.0.0",
|
||||||
|
# "bootstrap" => "7.2.0",
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user