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