1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the bootstrap-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\BootstrapBundle\Twig\Extension\CSS; |
13
|
|
|
|
14
|
|
|
use Twig\TwigFunction; |
15
|
|
|
use WBW\Library\Core\Argument\Helper\ArrayHelper; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Typography Twig extension. |
19
|
|
|
* |
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
21
|
|
|
* @package WBW\Bundle\BootstrapBundle\Twig\Extension\CSS |
22
|
|
|
* @link https://getbootstrap.com/docs/3.3/css/#type |
23
|
|
|
*/ |
24
|
|
|
class TypographyTwigExtension extends AbstractTypographyTwigExtension { |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Service name. |
28
|
|
|
* |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
const SERVICE_NAME = "wbw.bootstrap.twig.extension.css.typography"; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Displays a Bootstrap bold text. |
35
|
|
|
* |
36
|
|
|
* @param array $args The arguments. |
37
|
|
|
* @return string Returns the Bootstrap bold text. |
38
|
|
|
*/ |
39
|
|
|
public function bootstrapBoldFunction(array $args = []): string { |
40
|
|
|
return $this->bootstrapBold(ArrayHelper::get($args, "content")); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Displays a Bootstrap deleted text. |
45
|
|
|
* |
46
|
|
|
* @param array $args The arguments. |
47
|
|
|
* @return string Returns the Bootstrap deleted text. |
48
|
|
|
*/ |
49
|
|
|
public function bootstrapDeletedFunction(array $args = []): string { |
50
|
|
|
return $this->bootstrapDeleted(ArrayHelper::get($args, "content")); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Displays a Boostrap heading 1. |
55
|
|
|
* |
56
|
|
|
* @param array $args The arguments. |
57
|
|
|
* @return string Returns the Bootstrap heading 1. |
58
|
|
|
*/ |
59
|
|
|
public function bootstrapHeading1Function(array $args = []): string { |
60
|
|
|
return $this->bootstrapHeading(1, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Displays a Bootstrap heading 2. |
65
|
|
|
* |
66
|
|
|
* @param array $args The arguments. |
67
|
|
|
* @return string Returns the Bootstrap heading 2. |
68
|
|
|
*/ |
69
|
|
|
public function bootstrapHeading2Function(array $args = []): string { |
70
|
|
|
return $this->bootstrapHeading(2, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Displays a Bootstrap heading 3. |
75
|
|
|
* |
76
|
|
|
* @param array $args The arguments. |
77
|
|
|
* @return string Returns the Bootstrap heading 3. |
78
|
|
|
*/ |
79
|
|
|
public function bootstrapHeading3Function(array $args = []): string { |
80
|
|
|
return $this->bootstrapHeading(3, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Displays a Bootstrap heading 4. |
85
|
|
|
* |
86
|
|
|
* @param array $args The arguments. |
87
|
|
|
* @return string Returns the Bootstrap heading 4. |
88
|
|
|
*/ |
89
|
|
|
public function bootstrapHeading4Function(array $args = []): string { |
90
|
|
|
return $this->bootstrapHeading(4, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Displays a heading 5. |
95
|
|
|
* |
96
|
|
|
* @param array $args The arguments. |
97
|
|
|
* @return string Returns the Bootstrap heading 5. |
98
|
|
|
*/ |
99
|
|
|
public function bootstrapHeading5Function(array $args = []): string { |
100
|
|
|
return $this->bootstrapHeading(5, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Displays a Bootstrap heading 6. |
105
|
|
|
* |
106
|
|
|
* @param array $args The arguments. |
107
|
|
|
* @return string Returns the Bootstrap heading 6. |
108
|
|
|
*/ |
109
|
|
|
public function bootstrapHeading6Function(array $args = []): string { |
110
|
|
|
return $this->bootstrapHeading(6, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Displays a Bootstrap inserted text. |
115
|
|
|
* |
116
|
|
|
* @param array $args The arguments. |
117
|
|
|
* @return string Returns the Bootstrap inserted text. |
118
|
|
|
*/ |
119
|
|
|
public function bootstrapInsertedFunction(array $args = []): string { |
120
|
|
|
return $this->bootstrapInserted(ArrayHelper::get($args, "content")); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Displays a Bootstrap italic text. |
125
|
|
|
* |
126
|
|
|
* @param array $args The arguments. |
127
|
|
|
* @return string Returns the Bootstrap italic text. |
128
|
|
|
*/ |
129
|
|
|
public function bootstrapItalicFunction(array $args = []): string { |
130
|
|
|
return $this->bootstrapItalic(ArrayHelper::get($args, "content")); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Displays a Bootstrap marked text. |
135
|
|
|
* |
136
|
|
|
* @param array $args The arguments. |
137
|
|
|
* @return string Returns the Bootstrap marked text. |
138
|
|
|
*/ |
139
|
|
|
public function bootstrapMarkedFunction(array $args = []): string { |
140
|
|
|
return $this->bootstrapMarked(ArrayHelper::get($args, "content")); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Displays a Bootstrap small text. |
145
|
|
|
* |
146
|
|
|
* @param array $args The arguments. |
147
|
|
|
* @return string Returns the Bootstrap small text. |
148
|
|
|
*/ |
149
|
|
|
public function bootstrapSmallFunction(array $args = []): string { |
150
|
|
|
return $this->bootstrapSmall(ArrayHelper::get($args, "content")); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Displays a Bootstrap strike through text. |
155
|
|
|
* |
156
|
|
|
* @param array $args The arguments. |
157
|
|
|
* @return string Returns the Bootstrap strike through text. |
158
|
|
|
*/ |
159
|
|
|
public function bootstrapStrikeThroughFunction(array $args = []): string { |
160
|
|
|
return $this->bootstrapStrikeThrough(ArrayHelper::get($args, "content")); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* Displays a Bootstrap underlined text. |
165
|
|
|
* |
166
|
|
|
* @param array $args The arguments. |
167
|
|
|
* @return string Returns the Bootstrap underlined text. |
168
|
|
|
*/ |
169
|
|
|
public function bootstrapUnderlinedFunction(array $args = []): string { |
170
|
|
|
return $this->bootstrapUnderlined(ArrayHelper::get($args, "content")); |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Get the Twig functions. |
175
|
|
|
* |
176
|
|
|
* @return TwigFunction[] Returns the Twig functions. |
177
|
|
|
*/ |
178
|
|
|
public function getFunctions(): array { |
179
|
|
|
return [ |
180
|
|
|
new TwigFunction("bootstrapBold", [$this, "bootstrapBoldFunction"], ["is_safe" => ["html"]]), |
181
|
|
|
new TwigFunction("bsBold", [$this, "bootstrapBoldFunction"], ["is_safe" => ["html"]]), |
182
|
|
|
|
183
|
|
|
new TwigFunction("bootstrapDeleted", [$this, "bootstrapDeletedFunction"], ["is_safe" => ["html"]]), |
184
|
|
|
new TwigFunction("bsDeleted", [$this, "bootstrapDeletedFunction"], ["is_safe" => ["html"]]), |
185
|
|
|
|
186
|
|
|
new TwigFunction("bootstrapHeading1", [$this, "bootstrapHeading1Function"], ["is_safe" => ["html"]]), |
187
|
|
|
new TwigFunction("bsHeading1", [$this, "bootstrapHeading1Function"], ["is_safe" => ["html"]]), |
188
|
|
|
|
189
|
|
|
new TwigFunction("bootstrapHeading2", [$this, "bootstrapHeading2Function"], ["is_safe" => ["html"]]), |
190
|
|
|
new TwigFunction("bsHeading2", [$this, "bootstrapHeading2Function"], ["is_safe" => ["html"]]), |
191
|
|
|
|
192
|
|
|
new TwigFunction("bootstrapHeading3", [$this, "bootstrapHeading3Function"], ["is_safe" => ["html"]]), |
193
|
|
|
new TwigFunction("bsHeading3", [$this, "bootstrapHeading3Function"], ["is_safe" => ["html"]]), |
194
|
|
|
|
195
|
|
|
new TwigFunction("bootstrapHeading4", [$this, "bootstrapHeading4Function"], ["is_safe" => ["html"]]), |
196
|
|
|
new TwigFunction("bsHeading4", [$this, "bootstrapHeading4Function"], ["is_safe" => ["html"]]), |
197
|
|
|
|
198
|
|
|
new TwigFunction("bootstrapHeading5", [$this, "bootstrapHeading5Function"], ["is_safe" => ["html"]]), |
199
|
|
|
new TwigFunction("bsHeading5", [$this, "bootstrapHeading5Function"], ["is_safe" => ["html"]]), |
200
|
|
|
|
201
|
|
|
new TwigFunction("bootstrapHeading6", [$this, "bootstrapHeading6Function"], ["is_safe" => ["html"]]), |
202
|
|
|
new TwigFunction("bsHeading6", [$this, "bootstrapHeading6Function"], ["is_safe" => ["html"]]), |
203
|
|
|
|
204
|
|
|
new TwigFunction("bootstrapInserted", [$this, "bootstrapInsertedFunction"], ["is_safe" => ["html"]]), |
205
|
|
|
new TwigFunction("bsInserted", [$this, "bootstrapInsertedFunction"], ["is_safe" => ["html"]]), |
206
|
|
|
|
207
|
|
|
new TwigFunction("bootstrapItalic", [$this, "bootstrapItalicFunction"], ["is_safe" => ["html"]]), |
208
|
|
|
new TwigFunction("bsItalic", [$this, "bootstrapItalicFunction"], ["is_safe" => ["html"]]), |
209
|
|
|
|
210
|
|
|
new TwigFunction("bootstrapMarked", [$this, "bootstrapMarkedFunction"], ["is_safe" => ["html"]]), |
211
|
|
|
new TwigFunction("bsMarked", [$this, "bootstrapMarkedFunction"], ["is_safe" => ["html"]]), |
212
|
|
|
|
213
|
|
|
new TwigFunction("bootstrapSmall", [$this, "bootstrapSmallFunction"], ["is_safe" => ["html"]]), |
214
|
|
|
new TwigFunction("bsSmall", [$this, "bootstrapSmallFunction"], ["is_safe" => ["html"]]), |
215
|
|
|
|
216
|
|
|
new TwigFunction("bootstrapStrikethrough", [$this, "bootstrapStrikethroughFunction"], ["is_safe" => ["html"]]), |
217
|
|
|
new TwigFunction("bsStrikethrough", [$this, "bootstrapStrikethroughFunction"], ["is_safe" => ["html"]]), |
218
|
|
|
|
219
|
|
|
new TwigFunction("bootstrapUnderlined", [$this, "bootstrapUnderlinedFunction"], ["is_safe" => ["html"]]), |
220
|
|
|
new TwigFunction("bsUnderlined", [$this, "bootstrapUnderlinedFunction"], ["is_safe" => ["html"]]), |
221
|
|
|
]; |
222
|
|
|
} |
223
|
|
|
} |
224
|
|
|
|