ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
custom_icon.php File Reference

Go to the source code of this file.

Functions

 custom_icon ()
 

Function Documentation

◆ custom_icon()

custom_icon ( )

Definition at line 2 of file custom_icon.php.

References $DIC, and Vendor\Package\$f.

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 }
global $DIC
Definition: goto.php:24