1 | <?php |
||
26 | class ButtonUITwigExtension extends AbstractUITwigExtension { |
||
27 | |||
28 | /** |
||
29 | * Service name. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | const SERVICE_NAME = "webeweb.bundle.adminbsbbundle.twig.extension.ui.button"; |
||
34 | |||
35 | /** |
||
36 | * Constructor. |
||
37 | */ |
||
38 | public function __construct() { |
||
41 | |||
42 | /** |
||
43 | * Displays an AdminBSB button "Danger". |
||
44 | * |
||
45 | * @param array $args The arguments. |
||
46 | * @return string Returns the AdminBSB button "Danger". |
||
47 | */ |
||
48 | public function adminBSBButtonDangerFunction(array $args = []) { |
||
51 | |||
52 | /** |
||
53 | * Displays an AdminBSB button "Default". |
||
54 | * |
||
55 | * @param array $args The arguments. |
||
56 | * @return string Returns the AdminBSB button "Default". |
||
57 | */ |
||
58 | public function adminBSBButtonDefaultFunction(array $args = []) { |
||
61 | |||
62 | /** |
||
63 | * Displays an AdminBSB button "Info". |
||
64 | * |
||
65 | * @param array $args The arguments. |
||
66 | * @return string Returns the AdminBSB button "Info". |
||
67 | */ |
||
68 | public function adminBSBButtonInfoFunction(array $args = []) { |
||
71 | |||
72 | /** |
||
73 | * Displays an AdminBSB button "Link". |
||
74 | * |
||
75 | * @param string $button The button. |
||
76 | * @param string $link The link. |
||
77 | * @return string Returns the AdminBSB button "Link". |
||
78 | */ |
||
79 | public function adminBSBButtonLinkFilter($button, $link = self::DEFAULT_HREF) { |
||
80 | return StringUtility::replace($button, ["<button", "type=\"button\"", "</button>"], ["<a", "href=\"" . $link . "\"", "</a>"]); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Displays an AdminBSB button "Primary". |
||
85 | * |
||
86 | * @param array $args The arguments. |
||
87 | * @return string Returns the AdminBSB button "Primary". |
||
88 | */ |
||
89 | public function adminBSBButtonPrimaryFunction(array $args = []) { |
||
90 | return $this->adminBSBButton(ArrayUtility::get($args, "content"), ArrayUtility::get($args, "title"), ArrayUtility::get($args, "size", false), ArrayUtility::get($args, "block", false), ArrayUtility::get($args, "disable", false), "btn-primary", ArrayUtility::get($args, "icon"), ArrayUtility::get($args, "circle", false)); |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * Displays an AdminBSB button "Success". |
||
95 | * |
||
96 | * @param array $args The arguments. |
||
97 | * @return string Returns the AdminBSB button "Success". |
||
98 | */ |
||
99 | public function adminBSBButtonSuccessFunction(array $args = []) { |
||
100 | return $this->adminBSBButton(ArrayUtility::get($args, "content"), ArrayUtility::get($args, "title"), ArrayUtility::get($args, "size", false), ArrayUtility::get($args, "block", false), ArrayUtility::get($args, "disable", false), "btn-success", ArrayUtility::get($args, "icon"), ArrayUtility::get($args, "circle", false)); |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * Displays an AdminBSB button "Warning". |
||
105 | * |
||
106 | * @param array $args The arguments. |
||
107 | * @return string Returns the AdminBSB button "Warning". |
||
108 | */ |
||
109 | public function adminBSBButtonWarningFunction(array $args = []) { |
||
110 | return $this->adminBSBButton(ArrayUtility::get($args, "content"), ArrayUtility::get($args, "title"), ArrayUtility::get($args, "size", false), ArrayUtility::get($args, "block", false), ArrayUtility::get($args, "disable", false), "btn-warning", ArrayUtility::get($args, "icon"), ArrayUtility::get($args, "circle", false)); |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * Displays a AdminBSB material design button. |
||
115 | * |
||
116 | * @param array $args The arguments. |
||
117 | * @return string Returns the AdminBSB material design button. |
||
118 | */ |
||
119 | public function adminBSBMaterialDesignButtonFunction(array $args = []) { |
||
122 | |||
123 | /** |
||
124 | * Get the Twig filters. |
||
125 | * |
||
126 | * @return array Returns the Twig filters. |
||
127 | */ |
||
128 | public function getFilters() { |
||
133 | |||
134 | /** |
||
135 | * Get the Twig functions. |
||
136 | * |
||
137 | * @return array Returns the Twig functions. |
||
138 | */ |
||
139 | public function getFunctions() { |
||
150 | |||
151 | } |
||
152 |