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