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\Bundle\BootstrapBundle\Twig\Extension\Component\ProgressBarTwigExtension as BaseTwigExtension; |
17
|
|
|
use WBW\Library\Core\Utility\Argument\ArrayUtility; |
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 = "webeweb.adminbsbbundle.twig.extension.ui.progressbar"; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Constructor. |
36
|
|
|
*/ |
37
|
|
|
public function __construct() { |
38
|
|
|
parent::__construct(); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Displays an AdminBSB progress bar "Material design". |
43
|
|
|
* |
44
|
|
|
* @param array $args The arguments. |
45
|
|
|
* @return string Returns the AdminBSB progress bar "Material design". |
46
|
|
|
*/ |
47
|
|
|
public function adminBSBProgressBarMaterialDesignFunction(array $args = []) { |
48
|
|
|
return $this->bootstrapProgressBar(ArrayUtility::get($args, "content"), ArrayUtility::get($args, "value", 50), ArrayUtility::get($args, "min", 0), ArrayUtility::get($args, "max", 100), ArrayUtility::get($args, "striped", false), ArrayUtility::get($args, "animated", false), AbstractAdminBSBTwigExtension::fixColor(ArrayUtility::get($args, "color", "red"), "bg-")); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Get the Twig functions. |
53
|
|
|
* |
54
|
|
|
* @return array Returns the Twig functions. |
55
|
|
|
*/ |
56
|
|
|
public function getFunctions() { |
57
|
|
|
return [ |
58
|
|
|
new Twig_SimpleFunction("adminBSBProgressBarMaterialDesign", [$this, "adminBSBProgressBarMaterialDesignFunction"], ["is_safe" => ["html"]]), |
59
|
|
|
]; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
} |
63
|
|
|
|