1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8function wikiplugin_icon_info()
9{
10	return [
11		'name' => tra('Icon'),
12		'documentation' => 'PluginIcon',
13		'description' => tra('Display an icon'),
14		'prefs' => ['wikiplugin_icon'],
15		'iconname' => 'information',
16		'tags' => ['basic'],
17		'format' => 'html',
18		'introduced' => 14.1,
19		'extraparams' => true,
20		'params' => [
21			'name' => [
22				'required' => true,
23				'name' => tra('Name'),
24				'description' => tra('Name of the icon'),
25				'since' => '14.1',
26				'filter' => 'text',
27				'accepted' => tra('Valid icon name'),
28				'default' => '',
29			],
30			'size' => [
31				'required' => false,
32				'name' => tra('Size'),
33				'description' => tra('Size of the icon (greater than 0 and less than 10).'),
34				'since' => '14.1',
35				'default' => 1,
36				'filter' => 'digits',
37				'accepted' => tra('greater than 0 and less than 10'),
38				'type' => 'digits',
39			],
40			'rotate' => [
41				'required' => false,
42				'name' => tra('Rotate'),
43				'description' => tra('Rotate the icon (90, 180 or 270 degrees) or flip it (horizontal or vertical).'),
44				'since' => '17.1',
45				'default' => '',
46				'filter' => 'text',
47				'accepted' => tra('90, 180, 270, horizontal, vertical'),
48				'type' => 'text',
49			],
50			'style' => [
51				'required' => false,
52				'name' => tra('Style'),
53				'description' => tra('Style supported by the current icon set.'),
54				'since' => '19.0',
55				'default' => '',
56				'filter' => 'text',
57				'type' => 'text',
58			],
59		]
60	];
61}
62
63function wikiplugin_icon($data, $params)
64{
65	$smarty = TikiLib::lib('smarty');
66	$smarty->loadPlugin('smarty_function_icon');
67
68	return smarty_function_icon($params, $smarty->getEmptyInternalTemplate());
69}
70