1 | <?php |
||
23 | class BootstrapIconExtension extends Twig_Extension |
||
24 | { |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $iconPrefix; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $iconTag; |
||
34 | |||
35 | /** |
||
36 | * @param string $iconPrefix |
||
37 | * @param string $iconTag |
||
38 | */ |
||
39 | public function __construct($iconPrefix, $iconTag = 'span') |
||
44 | |||
45 | /** |
||
46 | * {@inheritDoc} |
||
47 | */ |
||
48 | public function getFilters() |
||
58 | |||
59 | /** |
||
60 | * {@inheritDoc} |
||
61 | */ |
||
62 | public function getFunctions() |
||
72 | |||
73 | /** |
||
74 | * Parses the given string and replaces all occurrences of .icon-[name] with the corresponding icon. |
||
75 | * |
||
76 | * @param string $text The text to parse |
||
77 | * |
||
78 | * @return string The HTML code with the icons |
||
79 | */ |
||
80 | public function parseIconsFilter($text) |
||
92 | |||
93 | /** |
||
94 | * Returns the HTML code for the given icon. |
||
95 | * |
||
96 | * @param string $icon The name of the icon |
||
97 | * @param string $iconSet The icon-set name |
||
98 | * |
||
99 | * @return string The HTML code for the icon |
||
100 | */ |
||
101 | public function iconFunction($icon, $iconSet = 'icon') |
||
108 | |||
109 | /** |
||
110 | * {@inheritDoc} |
||
111 | */ |
||
112 | public function getName() |
||
116 | } |
||
117 |