1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Contains the component class for rendering an icon. |
4
|
|
|
* |
5
|
|
|
* @copyright (C) 2018, Tobias Oetterer, Paderborn University |
6
|
|
|
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3 (or later) |
7
|
|
|
* |
8
|
|
|
* This file is part of the MediaWiki extension BootstrapComponents. |
9
|
|
|
* The BootstrapComponents extension is free software: you can redistribute it |
10
|
|
|
* and/or modify it under the terms of the GNU General Public License as published |
11
|
|
|
* by the Free Software Foundation, either version 3 of the License, or |
12
|
|
|
* (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* The BootstrapComponents extension is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU General Public License |
20
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
21
|
|
|
* |
22
|
|
|
* @file |
23
|
|
|
* @ingroup BootstrapComponents |
24
|
|
|
* @author Tobias Oetterer |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
namespace BootstrapComponents\Components; |
28
|
|
|
|
29
|
|
|
use BootstrapComponents\AbstractComponent; |
30
|
|
|
use \Html; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Class Icon |
34
|
|
|
* |
35
|
|
|
* Class for component 'icon' |
36
|
|
|
* |
37
|
|
|
* @see https://github.com/oetterer/BootstrapComponents/blob/master/docs/components.md#Icon |
38
|
|
|
* @since 1.0 |
39
|
|
|
*/ |
40
|
|
|
class Icon extends AbstractComponent { |
41
|
|
|
/** |
42
|
|
|
* @inheritdoc |
43
|
|
|
* |
44
|
|
|
* @param string $input |
45
|
|
|
*/ |
46
|
6 |
|
public function placeMe( $input ) { |
47
|
6 |
|
if ( empty( $input ) ) { |
48
|
3 |
|
return $this->getParserOutputHelper()->renderErrorMessage( 'bootstrap-components-glyph-icon-name-missing' ); |
49
|
|
|
} |
50
|
|
|
|
51
|
4 |
|
return Html::rawElement( |
52
|
4 |
|
'span', |
53
|
4 |
|
[ 'class' => 'glyphicon glyphicon-' . strtolower( trim( $input ) ) ] |
54
|
4 |
|
); |
55
|
|
|
} |
56
|
|
|
} |