ILIAS  release_8 Revision v8.24
custom_icon.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
7function custom_icon()
8{
9 global $DIC;
10 $f = $DIC->ui()->factory();
11 $renderer = $DIC->ui()->renderer();
12
13 $buffer = array();
14
15 $path = './src/UI/examples/Symbol/Icon/Custom/my_custom_icon.svg';
16 $ico = $f->symbol()->icon()->custom($path, 'Example');
17
18 $buffer[] = $renderer->render($ico)
19 . ' Small Custom Icon';
20
21 $buffer[] = $renderer->render($ico->withSize('medium'))
22 . ' Medium Custom Icon';
23
24 $buffer[] = $renderer->render($ico->withSize('large'))
25 . ' Large Custom Icon';
26
27
28 //Note that the svg needs to contain strictly valid xml to work with abbreviations.
29 //Some exports e.g. form illustrator seem to be not properly formatted by default.
30 $path = './templates/default/images/icon_fold.svg';
31 $ico = $f->symbol()->icon()->custom($path, 'Example')
32 ->withAbbreviation('FD');
33
34 $buffer[] = $renderer->render($ico)
35 . ' Small Custom Icon with Abbreviation';
36
37 $buffer[] = $renderer->render($ico->withSize('medium'))
38 . ' Medium Custom Icon with Abbreviation';
39
40 $buffer[] = $renderer->render($ico->withSize('large'))
41 . ' Large Custom Icon with Abbreviation';
42
43
44 return implode('<br><br>', $buffer);
45}
global $DIC
Definition: feed.php:28
$path
Definition: ltiservices.php:32