1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the adminbsb-material-design-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2017 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\UI; |
13
|
|
|
|
14
|
|
|
use Twig_SimpleFunction; |
15
|
|
|
use WBW\Bundle\AdminBSBBundle\Twig\Extension\AbstractAdminBSBTwigExtension; |
16
|
|
|
use WBW\Library\Core\Utility\Argument\ArrayUtility; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Preloader Twig extension. |
20
|
|
|
* |
21
|
|
|
* @author webeweb <https://github.com/webeweb/> |
22
|
|
|
* @package WBW\Bundle\AdminBSBBundle\Twig\Extension\UI |
23
|
|
|
*/ |
24
|
|
|
class PreloaderTwigExtension extends AbstractPreloaderTwigExtension { |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Service name. |
28
|
|
|
* |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
const SERVICE_NAME = "webeweb.adminbsbbundle.twig.extension.ui.preloader"; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Constructor. |
35
|
|
|
*/ |
36
|
|
|
public function __construct() { |
37
|
|
|
parent::__construct(); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Displays an AdminBSB preloader "Material design" L. |
42
|
|
|
* |
43
|
|
|
* @param array $args The arguments. |
44
|
|
|
* @return string Retruns the AdminBSB preloader "Material design" L. |
45
|
|
|
*/ |
46
|
|
|
public function adminBSBPreloaderMaterialDesignLFunction(array $args = []) { |
47
|
|
|
return $this->adminBSBPreloader(AbstractAdminBSBTwigExtension::fixColor(ArrayUtility::get($args, "color", "red"), "pl-"), "l"); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Displays an AdminBSB preloader "Material design" S. |
52
|
|
|
* |
53
|
|
|
* @param array $args The arguments. |
54
|
|
|
* @return string Retruns the AdminBSB preloader "Material design" S. |
55
|
|
|
*/ |
56
|
|
|
public function adminBSBPreloaderMaterialDesignSFunction(array $args = []) { |
57
|
|
|
return $this->adminBSBPreloader(AbstractAdminBSBTwigExtension::fixColor(ArrayUtility::get($args, "color", "red"), "pl-"), "s"); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Displays an AdminBSB preloader "Material design" SM. |
62
|
|
|
* |
63
|
|
|
* @param array $args The arguments. |
64
|
|
|
* @return string Retruns the AdminBSB preloader "Material design" SM. |
65
|
|
|
*/ |
66
|
|
|
public function adminBSBPreloaderMaterialDesignSMFunction(array $args = []) { |
67
|
|
|
return $this->adminBSBPreloader(AbstractAdminBSBTwigExtension::fixColor(ArrayUtility::get($args, "color", "red"), "pl-"), "sm"); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Displays an AdminBSB preloader "Material design" XL. |
72
|
|
|
* |
73
|
|
|
* @param array $args The arguments. |
74
|
|
|
* @return string Retruns the AdminBSB preloader "Material design" XL. |
75
|
|
|
*/ |
76
|
|
|
public function adminBSBPreloaderMaterialDesignXLFunction(array $args = []) { |
77
|
|
|
return $this->adminBSBPreloader(AbstractAdminBSBTwigExtension::fixColor(ArrayUtility::get($args, "color", "red"), "pl-"), "xl"); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Displays an AdminBSB preloader "Material design" XS. |
82
|
|
|
* |
83
|
|
|
* @param array $args The arguments. |
84
|
|
|
* @return string Retruns the AdminBSB preloader "Material design" XS. |
85
|
|
|
*/ |
86
|
|
|
public function adminBSBPreloaderMaterialDesignXSFunction(array $args = []) { |
87
|
|
|
return $this->adminBSBPreloader(AbstractAdminBSBTwigExtension::fixColor(ArrayUtility::get($args, "color", "red"), "pl-"), "xs"); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Get the Twig functions. |
92
|
|
|
* |
93
|
|
|
* @return array Returns the Twig functions. |
94
|
|
|
*/ |
95
|
|
|
public function getFunctions() { |
96
|
|
|
return [ |
97
|
|
|
new Twig_SimpleFunction("adminBSBPreloaderMaterialDesignL", [$this, "adminBSBPreloaderMaterialDesignLFunction"], ["is_safe" => ["html"]]), |
98
|
|
|
new Twig_SimpleFunction("adminBSBPreloaderMaterialDesignS", [$this, "adminBSBPreloaderMaterialDesignSFunction"], ["is_safe" => ["html"]]), |
99
|
|
|
new Twig_SimpleFunction("adminBSBPreloaderMaterialDesignSM", [$this, "adminBSBPreloaderMaterialDesignSMFunction"], ["is_safe" => ["html"]]), |
100
|
|
|
new Twig_SimpleFunction("adminBSBPreloaderMaterialDesignXL", [$this, "adminBSBPreloaderMaterialDesignXLFunction"], ["is_safe" => ["html"]]), |
101
|
|
|
new Twig_SimpleFunction("adminBSBPreloaderMaterialDesignXS", [$this, "adminBSBPreloaderMaterialDesignXSFunction"], ["is_safe" => ["html"]]), |
102
|
|
|
]; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
} |
106
|
|
|
|