1 | <?php namespace Arcanesoft\Core\Helpers\UI; |
||
9 | class Button extends AbstractClickable |
||
10 | { |
||
11 | /* ----------------------------------------------------------------- |
||
12 | | Properties |
||
13 | | ----------------------------------------------------------------- |
||
14 | */ |
||
15 | /** @var string */ |
||
16 | protected $type; |
||
17 | |||
18 | /* ----------------------------------------------------------------- |
||
19 | | Constructor |
||
20 | | ----------------------------------------------------------------- |
||
21 | */ |
||
22 | /** |
||
23 | * Button constructor. |
||
24 | * |
||
25 | * @param string $action |
||
26 | * @param string $type |
||
27 | * @param array $attributes |
||
28 | * @param bool $disabled |
||
29 | */ |
||
30 | 54 | public function __construct($action, $type = 'button', array $attributes = [], $disabled) |
|
37 | |||
38 | /* ----------------------------------------------------------------- |
||
39 | | Getters & Setters |
||
40 | | ----------------------------------------------------------------- |
||
41 | */ |
||
42 | /** |
||
43 | * Set the button type. |
||
44 | * |
||
45 | * @param string $type |
||
46 | * |
||
47 | * @return self |
||
48 | */ |
||
49 | 54 | public function setType($type) |
|
55 | |||
56 | /* ----------------------------------------------------------------- |
||
57 | | Main Methods |
||
58 | | ----------------------------------------------------------------- |
||
59 | */ |
||
60 | /** |
||
61 | * Make a button instance. |
||
62 | * |
||
63 | * @param string $action |
||
64 | * @param string $type |
||
65 | * @param array $attributes |
||
66 | * @param bool $disabled |
||
67 | * |
||
68 | * @return self |
||
69 | */ |
||
70 | 54 | public static function make($action, $type = 'button', array $attributes = [], $disabled = false) |
|
74 | |||
75 | /** |
||
76 | * Get content as a string of HTML. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 54 | public function toHtml() |
|
84 | |||
85 | /* ----------------------------------------------------------------- |
||
86 | | Other Methods |
||
87 | | ----------------------------------------------------------------- |
||
88 | */ |
||
89 | /** |
||
90 | * Render the attributes. |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | 54 | protected function renderAttributes() |
|
113 | |||
114 | /** |
||
115 | * Get the value from config. |
||
116 | * |
||
117 | * @param string $key |
||
118 | * |
||
119 | * @return mixed |
||
120 | */ |
||
121 | 54 | protected function getConfig($key) |
|
125 | } |
||
126 |