1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the adminbsb-material-design-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\AdminBSBBundle\Twig\Extension\Typography; |
13
|
|
|
|
14
|
|
|
use Twig_SimpleFunction; |
15
|
|
|
use WBW\Library\Core\Utility\Argument\ArrayUtility; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Typography Twig extension. |
19
|
|
|
* |
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
21
|
|
|
* @package WBW\Bundle\AdminBSBBundle\Twig\Extension\Typography |
22
|
|
|
*/ |
23
|
|
|
class TypographyTwigExtension extends AbstractTypographyTwigExtension { |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Service name. |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
const SERVICE_NAME = "webeweb.adminbsbbundle.twig.extension.typography"; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Constructor. |
34
|
|
|
*/ |
35
|
|
|
public function __construct() { |
36
|
|
|
parent::__construct(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Displays an AdminBSB bold text. |
41
|
|
|
* |
42
|
|
|
* @param array $args The arguments. |
43
|
|
|
* @return string Returns the AdminBSB bold text. |
44
|
|
|
*/ |
45
|
|
|
public function adminBSBBoldFunction(array $args = []) { |
46
|
|
|
return $this->adminBSBBold(ArrayUtility::get($args, "content")); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Displays an AdminBSB italic text. |
51
|
|
|
* |
52
|
|
|
* @param array $args The arguments. |
53
|
|
|
* @return string Returns the AdminBSB italic text. |
54
|
|
|
*/ |
55
|
|
|
public function adminBSBItalicFunction(array $args = []) { |
56
|
|
|
return $this->adminBSBItalic(ArrayUtility::get($args, "content")); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Displays an AdminBSB overlined text. |
61
|
|
|
* |
62
|
|
|
* @param array $args The arguments. |
63
|
|
|
* @return string Returns the AdminBSB overlined text. |
64
|
|
|
*/ |
65
|
|
|
public function adminBSBOverlineFunction(array $args = []) { |
66
|
|
|
return $this->adminBSBOverline(ArrayUtility::get($args, "content")); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Displays an AdminBSB line through text. |
71
|
|
|
* |
72
|
|
|
* @param array $args The arguments. |
73
|
|
|
* @return string Returns the AdminBSB line through text. |
74
|
|
|
*/ |
75
|
|
|
public function adminBSBLineThroughFunction(array $args = []) { |
76
|
|
|
return $this->adminBSBLineThrough(ArrayUtility::get($args, "content")); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Displays an AdminBSB underline text. |
81
|
|
|
* |
82
|
|
|
* @param array $args The arguments. |
83
|
|
|
* @return string Returns the AdminBSB underline text. |
84
|
|
|
*/ |
85
|
|
|
public function adminBSBUnderlineFunction(array $args = []) { |
86
|
|
|
return $this->adminBSBUnderline(ArrayUtility::get($args, "content")); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Get the Twig functions. |
91
|
|
|
* |
92
|
|
|
* @return array Returns the Twig functions. |
93
|
|
|
*/ |
94
|
|
|
public function getFunctions() { |
95
|
|
|
return [ |
96
|
|
|
new Twig_SimpleFunction("adminBSBBold", [$this, "adminBSBBoldFunction"], ["is_safe" => ["html"]]), |
97
|
|
|
new Twig_SimpleFunction("adminBSBItalic", [$this, "adminBSBItalicFunction"], ["is_safe" => ["html"]]), |
98
|
|
|
new Twig_SimpleFunction("adminBSBOverline", [$this, "adminBSBOverlineFunction"], ["is_safe" => ["html"]]), |
99
|
|
|
new Twig_SimpleFunction("adminBSBLineThrough", [$this, "adminBSBLineThroughFunction"], ["is_safe" => ["html"]]), |
100
|
|
|
new Twig_SimpleFunction("adminBSBUnderline", [$this, "adminBSBUnderlineFunction"], ["is_safe" => ["html"]]), |
101
|
|
|
]; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
} |
105
|
|
|
|