|
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\TwigFilter; |
|
15
|
|
|
use Twig\TwigFunction; |
|
16
|
|
|
use WBW\Bundle\AdminBSBBundle\ProgressBar\ProgressBarFactory; |
|
17
|
|
|
use WBW\Bundle\BootstrapBundle\Twig\Extension\Component\ProgressBarTwigExtension as BaseTwigExtension; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Progress bar Twig extension. |
|
21
|
|
|
* |
|
22
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
23
|
|
|
* @package WBW\Bundle\AdminBSBBundle\Twig\Extension\UI |
|
24
|
|
|
*/ |
|
25
|
|
|
class ProgressBarTwigExtension extends BaseTwigExtension { |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Service name. |
|
29
|
|
|
* |
|
30
|
|
|
* @var string |
|
31
|
|
|
*/ |
|
32
|
|
|
const SERVICE_NAME = "wbw.adminbsb.twig.extension.ui.progress_bar"; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Displays an AdminBSB progress bar "Material design". |
|
36
|
|
|
* |
|
37
|
|
|
* @param array $args The arguments. |
|
38
|
|
|
* @return string Returns the AdminBSB progress bar "Material design". |
|
39
|
|
|
*/ |
|
40
|
|
|
public function adminBSBProgressBarMaterialDesignFunction(array $args = []): string { |
|
41
|
|
|
return $this->bootstrapProgressBar(ProgressBarFactory::parseMaterialDesignProgressBar($args)); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Get the Twig filters. |
|
46
|
|
|
* |
|
47
|
|
|
* @return TwigFilter[] Returns the Twig filters. |
|
48
|
|
|
*/ |
|
49
|
|
|
public function getFilters(): array { |
|
50
|
|
|
return []; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Get the Twig functions. |
|
55
|
|
|
* |
|
56
|
|
|
* @return TwigFunction[] Returns the Twig functions. |
|
57
|
|
|
*/ |
|
58
|
|
|
public function getFunctions(): array { |
|
59
|
|
|
return [ |
|
60
|
|
|
new TwigFunction("adminBSBProgressBarBasic", [$this, "bootstrapProgressBarBasicFunction"], ["is_safe" => ["html"]]), |
|
61
|
|
|
new TwigFunction("adminBSBProgressBarDanger", [$this, "bootstrapProgressBarDangerFunction"], ["is_safe" => ["html"]]), |
|
62
|
|
|
new TwigFunction("adminBSBProgressBarInfo", [$this, "bootstrapProgressBarInfoFunction"], ["is_safe" => ["html"]]), |
|
63
|
|
|
new TwigFunction("adminBSBProgressBarMaterialDesign", [$this, "adminBSBProgressBarMaterialDesignFunction"], ["is_safe" => ["html"]]), |
|
64
|
|
|
new TwigFunction("adminBSBProgressBarSuccess", [$this, "bootstrapProgressBarSuccessFunction"], ["is_safe" => ["html"]]), |
|
65
|
|
|
new TwigFunction("adminBSBProgressBarWarning", [$this, "bootstrapProgressBarWarningFunction"], ["is_safe" => ["html"]]), |
|
66
|
|
|
]; |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|