Create KirbyTag.

This commit is contained in:
2026-04-17 03:14:17 +10:00
parent 892dde104a
commit 538d58f5cb

View File

@@ -15,6 +15,8 @@ Kirby::plugin(
name: "hobbyhome/fontawesome",
extends: [
"options" => [
"defaultFamily" => "classic",
"defaultStyle" => "solid",
"assets" => [
"css" => [
150 => Url::path(kirby()->url("media") . "/plugins/hobbyhome/fontawesome/css/fontawesome" . r(!option("debug"), ".min") . ".css", true),
@@ -43,6 +45,40 @@ Kirby::plugin(
return $files;
},
],
"tags" => [
"fa" => [
"attr" => [
"style",
"class",
"family",
"fastyle",
"title",
],
"html" => function ($tag) {
$html = "";
if ($tag->style) {
$html .= "<span style=\"{$tag->style}\">";
}
$html .= "<i" .
" class=\"" .
r($tag->class, $tag->class . " ") .
"fa-" . r($tag->family, $tag->family, option("hobbyhome.fontawesome.defaultFamily")) . " " .
"fa-" . r($tag->fastyle, $tag->fastyle, option("hobbyhome.fontawesome.defaultStyle")) . " " .
"fa-" . $tag->value .
"\"" .
r($tag->title, " title=\"{$tag->title}\"") .
"></i>";
if ($tag->style) {
$html .= "</span>";
}
return $html;
},
],
],
],
info: [
"authors" => [[