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 WBW\Bundle\AdminBSBBundle\Twig\Extension\AbstractAdminBSBTwigExtension; |
15
|
|
|
use WBW\Library\Core\Utility\Argument\StringUtility; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Abstract checkbox Twig extension. |
19
|
|
|
* |
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
21
|
|
|
* @package WBW\Bundle\AdminBSBBundle\Twig\Extension\Form |
22
|
|
|
* @abstract |
23
|
|
|
*/ |
24
|
|
|
abstract class AbstractCheckboxTwigExtension extends AbstractAdminBSBTwigExtension { |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Constructor. |
28
|
|
|
*/ |
29
|
|
|
protected function __construct() { |
30
|
|
|
parent::__construct(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Displays a AdminBSB checkbox. |
35
|
|
|
* |
36
|
|
|
* @param string $content The content. |
37
|
|
|
* @param string $name The name. |
38
|
|
|
* @param string $id The id. |
39
|
|
|
* @param boolean $checked Checked ? |
40
|
|
|
* @param boolean $disabled Disabled ? |
41
|
|
|
* @param boolean $filledIn Filled in ? |
42
|
|
|
* @param string $class The class. |
43
|
|
|
* @return string Returns the AdminBSB checkbox. |
44
|
|
|
*/ |
45
|
|
|
protected function adminBSBCheckbox($content, $name, $id, $checked, $disabled, $filledIn, $class) { |
46
|
|
|
|
47
|
|
|
// Initialize the template. |
48
|
|
|
$template = "<input %attributes%>%innerHTML%"; |
49
|
|
|
|
50
|
|
|
// Initialize the attributes. |
51
|
|
|
$attributes = []; |
52
|
|
|
|
53
|
|
|
$attributes["class"] = [true === $filledIn ? "filled-in" : null, $class]; |
54
|
|
|
$attributes["name"] = $name; |
55
|
|
|
$attributes["type"] = "checkbox"; |
56
|
|
|
$attributes["id"] = $id; |
57
|
|
|
$attributes["checked"] = true === $checked ? "checked" : null; |
58
|
|
|
$attributes["disabled"] = true === $disabled ? "disabled" : null; |
59
|
|
|
|
60
|
|
|
// Check the parameters. |
61
|
|
|
$innerHTML = self::bootstrapHTMLElement("label", $content, ["for" => $attributes["id"]]); |
|
|
|
|
62
|
|
|
|
63
|
|
|
// Return the HTML. |
64
|
|
|
return StringUtility::replace($template, ["%attributes%", "%innerHTML%"], [StringUtility::parseArray($attributes), $innerHTML]); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.