|
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 WBW\Bundle\BootstrapBundle\Twig\Extension\AbstractTwigExtension; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Abstract typography Twig extension. |
|
18
|
|
|
* |
|
19
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
20
|
|
|
* @package WBW\Bundle\BootstrapBundle\Twig\Extension\CSS |
|
21
|
|
|
* @abstract |
|
22
|
|
|
*/ |
|
23
|
|
|
abstract class AbstractTypographyTwigExtension extends AbstractTwigExtension { |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Displays a Bootstrap bold text. |
|
27
|
|
|
* |
|
28
|
|
|
* @param string $content The content. |
|
29
|
|
|
* @return string Returns the Bootstrap bold text. |
|
30
|
|
|
*/ |
|
31
|
|
|
protected function bootstrapBold($content) { |
|
32
|
|
|
return static::coreHTMLElement("strong", $content); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Displays a Bootstrap deleted text. |
|
37
|
|
|
* |
|
38
|
|
|
* @param string $content The content. |
|
39
|
|
|
* @return string Returns the Bootstrap deleted text. |
|
40
|
|
|
*/ |
|
41
|
|
|
protected function bootstrapDeleted($content) { |
|
42
|
|
|
return static::coreHTMLElement("del", $content); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Displays a Bootstrap heading. |
|
47
|
|
|
* |
|
48
|
|
|
* @param int $size The size. |
|
49
|
|
|
* @param string $content The content. |
|
50
|
|
|
* @param string $description The description. |
|
51
|
|
|
* @param string $class The class. |
|
52
|
|
|
* @return string Returns the Bootstrap heading. |
|
53
|
|
|
*/ |
|
54
|
|
|
protected function bootstrapHeading($size, $content, $description, $class) { |
|
55
|
|
|
|
|
56
|
|
|
$sizes = [1, 2, 3, 4, 5, 6]; |
|
57
|
|
|
|
|
58
|
|
|
$attributes = []; |
|
59
|
|
|
|
|
60
|
|
|
$attributes["class"] = [$class]; |
|
61
|
|
|
|
|
62
|
|
|
$element = "h" . (true === in_array($size, $sizes) ? $size : 1); |
|
63
|
|
|
$secondary = null !== $description ? " <small>" . $description . "</small>" : ""; |
|
64
|
|
|
$innerHTML = (null !== $content ? $content : "") . $secondary; |
|
65
|
|
|
|
|
66
|
|
|
return static::coreHTMLElement($element, $innerHTML, $attributes); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Displays a Bootstrap inserted text. |
|
71
|
|
|
* |
|
72
|
|
|
* @param string $content The content. |
|
73
|
|
|
* @return string Returns the Bootstrap inserted text. |
|
74
|
|
|
*/ |
|
75
|
|
|
protected function bootstrapInserted($content) { |
|
76
|
|
|
return static::coreHTMLElement("ins", $content); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Displays a Bootstrap italic text. |
|
81
|
|
|
* |
|
82
|
|
|
* @param string $content The content. |
|
83
|
|
|
* @return string Returns the Bootstrap italic text. |
|
84
|
|
|
*/ |
|
85
|
|
|
protected function bootstrapItalic($content) { |
|
86
|
|
|
return static::coreHTMLElement("em", $content); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Displays a Bootstrap marked text. |
|
91
|
|
|
* |
|
92
|
|
|
* @param string $content The content. |
|
93
|
|
|
* @return string Returns the Bootstrap marked text. |
|
94
|
|
|
*/ |
|
95
|
|
|
protected function bootstrapMarked($content) { |
|
96
|
|
|
return static::coreHTMLElement("mark", $content); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* Displays a Bootstrap small text. |
|
101
|
|
|
* |
|
102
|
|
|
* @param string $content The content. |
|
103
|
|
|
* @return string Returns the Bootstrap small text. |
|
104
|
|
|
*/ |
|
105
|
|
|
protected function bootstrapSmall($content) { |
|
106
|
|
|
return static::coreHTMLElement("small", $content); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Displays a Bootstrap strike through text. |
|
111
|
|
|
* |
|
112
|
|
|
* @param string $content The content. |
|
113
|
|
|
* @return string Returns the Bootstrap strike through text. |
|
114
|
|
|
*/ |
|
115
|
|
|
protected function bootstrapStrikeThrough($content) { |
|
116
|
|
|
return static::coreHTMLElement("s", $content); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* Displays a Bootstrap underlined text. |
|
121
|
|
|
* |
|
122
|
|
|
* @param string $content The content. |
|
123
|
|
|
* @return string Returns the Bootstrap underlined text. |
|
124
|
|
|
*/ |
|
125
|
|
|
protected function bootstrapUnderlined($content) { |
|
126
|
|
|
return static::coreHTMLElement("u", $content); |
|
127
|
|
|
} |
|
128
|
|
|
} |
|
129
|
|
|
|