1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the bootstrap-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 NdC/WBW |
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\Typography; |
13
|
|
|
|
14
|
|
|
use Twig_SimpleFunction; |
15
|
|
|
use WBW\Library\Core\Utility\ArrayUtility; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Heading typography Twig extension. |
19
|
|
|
* |
20
|
|
|
* @author NdC/WBW <https://github.com/webeweb/> |
21
|
|
|
* @package WBW\Bundle\BootstrapBundle\Twig\Extension\Typography |
22
|
|
|
* @final |
23
|
|
|
*/ |
24
|
|
|
final class HeadingTypographyTwigExtension extends AbstractTypographyTwigExtension { |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Service name. |
28
|
|
|
* |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
const SERVICE_NAME = "webeweb.bundle.bootstrapbundle.twig.extension.typography.heading"; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Displays a Boostrap heading 1. |
35
|
|
|
* |
36
|
|
|
* @param array $args The arguments. |
37
|
|
|
* @return string Returns the Bootstrap heading 1. |
38
|
|
|
*/ |
39
|
|
|
public function bootstrapHeading1Function(array $args = []) { |
40
|
|
|
return $this->bootstrapHeading(1, ArrayUtility::get($args, "content"), ArrayUtility::get($args, "description"), ArrayUtility::get($args, "class")); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Displays a Bootstrap heading 2. |
45
|
|
|
* |
46
|
|
|
* @param array $args The arguments. |
47
|
|
|
* @return string Returns the Bootstrap heading 2. |
48
|
|
|
*/ |
49
|
|
|
public function bootstrapHeading2Function(array $args = []) { |
50
|
|
|
return $this->bootstrapHeading(2, ArrayUtility::get($args, "content"), ArrayUtility::get($args, "description"), ArrayUtility::get($args, "class")); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Displays a Bootstrap heading 3. |
55
|
|
|
* |
56
|
|
|
* @param array $args The arguments. |
57
|
|
|
* @return string Returns the Bootstrap heading 3. |
58
|
|
|
*/ |
59
|
|
|
public function bootstrapHeading3Function(array $args = []) { |
60
|
|
|
return $this->bootstrapHeading(3, ArrayUtility::get($args, "content"), ArrayUtility::get($args, "description"), ArrayUtility::get($args, "class")); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Displays a Bootstrap heading 4. |
65
|
|
|
* |
66
|
|
|
* @param array $args The arguments. |
67
|
|
|
* @return string Returns the Bootstrap heading 4. |
68
|
|
|
*/ |
69
|
|
|
public function bootstrapHeading4Function(array $args = []) { |
70
|
|
|
return $this->bootstrapHeading(4, ArrayUtility::get($args, "content"), ArrayUtility::get($args, "description"), ArrayUtility::get($args, "class")); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Displays a heading 5. |
75
|
|
|
* |
76
|
|
|
* @param array $args The arguments. |
77
|
|
|
* @return string Returns the Bootstrap heading 5. |
78
|
|
|
*/ |
79
|
|
|
public function bootstrapHeading5Function(array $args = []) { |
80
|
|
|
return $this->bootstrapHeading(5, ArrayUtility::get($args, "content"), ArrayUtility::get($args, "description"), ArrayUtility::get($args, "class")); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Displays a Bootstrap heading 6. |
85
|
|
|
* |
86
|
|
|
* @param array $args The arguments. |
87
|
|
|
* @return string Returns the Bootstrap heading 6. |
88
|
|
|
*/ |
89
|
|
|
public function bootstrapHeading6Function(array $args = []) { |
90
|
|
|
return $this->bootstrapHeading(6, ArrayUtility::get($args, "content"), ArrayUtility::get($args, "description"), ArrayUtility::get($args, "class")); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Get the Twig functions. |
95
|
|
|
* |
96
|
|
|
* @return array Returns the Twig functions. |
97
|
|
|
*/ |
98
|
|
|
public function getFunctions() { |
99
|
|
|
return [ |
100
|
|
|
new Twig_SimpleFunction("bootstrapHeading1", [$this, "bootstrapHeading1Function"], ["is_safe" => ["html"]]), |
101
|
|
|
new Twig_SimpleFunction("bootstrapHeading2", [$this, "bootstrapHeading2Function"], ["is_safe" => ["html"]]), |
102
|
|
|
new Twig_SimpleFunction("bootstrapHeading3", [$this, "bootstrapHeading3Function"], ["is_safe" => ["html"]]), |
103
|
|
|
new Twig_SimpleFunction("bootstrapHeading4", [$this, "bootstrapHeading4Function"], ["is_safe" => ["html"]]), |
104
|
|
|
new Twig_SimpleFunction("bootstrapHeading5", [$this, "bootstrapHeading5Function"], ["is_safe" => ["html"]]), |
105
|
|
|
new Twig_SimpleFunction("bootstrapHeading6", [$this, "bootstrapHeading6Function"], ["is_safe" => ["html"]]), |
106
|
|
|
]; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
} |
110
|
|
|
|