diff options
Diffstat (limited to 'src/view/AbstractBuilder.php')
| -rw-r--r-- | src/view/AbstractBuilder.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/view/AbstractBuilder.php b/src/view/AbstractBuilder.php index 3d315b1..b9a1d7f 100644 --- a/src/view/AbstractBuilder.php +++ b/src/view/AbstractBuilder.php | |||
| @@ -57,4 +57,21 @@ abstract class AbstractBuilder | |||
| 57 | { | 57 | { |
| 58 | $this->html .= $html; | 58 | $this->html .= $html; |
| 59 | } | 59 | } |
| 60 | |||
| 61 | protected function insertSVG(string $path, array $attributes = []): string | ||
| 62 | { | ||
| 63 | $svg = file_get_contents($path); | ||
| 64 | |||
| 65 | // modification des attributs | ||
| 66 | if(!empty($attributes)){ | ||
| 67 | $dom = new DOMDocument(); | ||
| 68 | $dom->loadXML($svg); | ||
| 69 | $svg_elem = $dom->documentElement; | ||
| 70 | foreach($attributes as $key => $value){ | ||
| 71 | $svg_elem->setAttribute($key, $value); | ||
| 72 | } | ||
| 73 | $svg = $dom->saveXML($svg_elem); | ||
| 74 | } | ||
| 75 | return $svg; | ||
| 76 | } | ||
| 60 | } \ No newline at end of file | 77 | } \ No newline at end of file |
