-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* Kirby3 plugin to gain easyaccess to `simple-icons` in Kirbytext. | ||
* | ||
* @version 1.0.0 | ||
* @author Lucas Becker <runxel> | ||
* @copyright Lucas Becker <runxel> | ||
* @link https://github.com/runxel/kirby3-simpleicons | ||
* @license MIT | ||
*/ | ||
|
||
Kirby::plugin('runxel/kirby-simpleicons', [ | ||
'tags' => [ | ||
'icon' => require_once __DIR__ . '/tags/icon.php' | ||
] | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
# site/plugins/kirby-simpleicons/tags/icon.php | ||
|
||
return array( | ||
// passed options | ||
'attr' => [ | ||
'class' | ||
], | ||
'html' => function($tag) { | ||
|
||
// get options | ||
$brand = $tag->icon; | ||
$cls = $tag->class; | ||
|
||
$icon_string = 'vendor/simple-icons/simple-icons/icons/' . $brand . '.svg'; | ||
$icon_svg = file_get_contents($icon_string) | ||
|
||
/* https://getkirby.com/docs/reference/tools/html/tag | ||
if HTML code is passed into Html::tag is must be wrappend in an array: | ||
*/ | ||
$html = Html::tag('span', [$icon_svg], [ | ||
'class' => $icons | ||
]); | ||
|
||
return $html; | ||
// <span class="cls"><svg … /></span> | ||
} | ||
); |