Completed
Push — master ( a2b9d1...d3fba9 )
by WEBEWEB
01:53
created

adminBSBRadioButtonMaterialDesignFunction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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\Form;
13
14
use Twig_SimpleFunction;
15
use WBW\Bundle\AdminBSBBundle\Twig\Extension\AbstractAdminBSBTwigExtension;
16
use WBW\Library\Core\Argument\ArrayHelper;
17
18
/**
19
 * Radio button Twig extension.
20
 *
21
 * @author webeweb <https://github.com/webeweb/>
22
 * @package WBW\Bundle\AdminBSBBundle\Twig\Extension\Form
23
 */
24
class RadioButtonTwigExtension extends AbstractRadioButtonTwigExtension {
25
26
    /**
27
     * Service name.
28
     *
29
     * @var string
30
     */
31
    const SERVICE_NAME = "webeweb.adminbsb.twig.extension.form.radio_button";
32
33
    /**
34
     * Displays an AdminBSB radio button "Basic".
35
     *
36
     * @param array $args The arguments.
37
     * @return string Returns the AdminBSB radio button "Basic".
38
     */
39
    public function adminBSBRadioButtonBasicFunction(array $args = []) {
40
        return $this->adminBSBRadioButton(ArrayHelper::get($args, "content"), ArrayHelper::get($args, "name"), ArrayHelper::get($args, "id"), ArrayHelper::get($args, "checked", false), ArrayHelper::get($args, "disabled", false), ArrayHelper::get($args, "withGap", false), ArrayHelper::get($args, "class"));
41
    }
42
43
    /**
44
     * Displays an AdminBSB radio button "Material design".
45
     *
46
     * @param array $args The arguments.
47
     * @return string Returns the AdminBSB radio button "Material design".
48
     */
49
    public function adminBSBRadioButtonMaterialDesignFunction(array $args = []) {
50
        return $this->adminBSBRadioButton(ArrayHelper::get($args, "content"), ArrayHelper::get($args, "name"), ArrayHelper::get($args, "id"), ArrayHelper::get($args, "checked", false), ArrayHelper::get($args, "disabled", false), ArrayHelper::get($args, "withGap", false), ArrayHelper::get($args, "class", "") . self::fixColor(ArrayHelper::get($args, "color", "red"), " radio-col-"));
51
    }
52
53
    /**
54
     * Get the Twig functions.
55
     *
56
     * @return array Returns the Twig functions.
57
     */
58
    public function getFunctions() {
59
        return [
60
            new Twig_SimpleFunction("adminBSBRadioButtonBasic", [$this, "adminBSBRadioButtonBasicFunction"], ["is_safe" => ["html"]]),
61
            new Twig_SimpleFunction("adminBSBRadioButtonMaterialDesign", [$this, "adminBSBRadioButtonMaterialDesignFunction"], ["is_safe" => ["html"]]),
62
        ];
63
    }
64
}
65