Forked from
Ad Aures / Castopod
763 commits behind the upstream repository.
-
Yassine Doghri authored
app, admin, install and authentication views are now located in root themes/ folder
Yassine Doghri authoredapp, admin, install and authentication views are now located in root themes/ folder
Icon.php 596 B
<?php
declare(strict_types=1);
namespace App\Views\Components;
use Exception;
use ViewComponents\Component;
class Icon extends Component
{
public string $glyph = '';
public function render(): string
{
try {
$svgContents = file_get_contents('assets/icons/' . $this->glyph . '.svg');
} catch (Exception) {
return '□';
}
if ($this->attributes['class'] !== '') {
$svgContents = str_replace('<svg', '<svg class="' . $this->attributes['class'] . '"', $svgContents);
}
return $svgContents;
}
}