1 | <?php namespace Arcanesoft\Core\Helpers\UI; |
||
9 | class Link extends AbstractClickable |
||
10 | { |
||
11 | /* ----------------------------------------------------------------- |
||
12 | | Properties |
||
13 | | ----------------------------------------------------------------- |
||
14 | */ |
||
15 | /** @var string */ |
||
16 | protected $url; |
||
17 | |||
18 | /* ----------------------------------------------------------------- |
||
19 | | Constructor |
||
20 | | ----------------------------------------------------------------- |
||
21 | */ |
||
22 | /** |
||
23 | * LinkElement constructor. |
||
24 | * |
||
25 | * @param string $action |
||
26 | * @param string $url |
||
27 | * @param array $attributes |
||
28 | * @param bool $disabled |
||
29 | */ |
||
30 | 54 | public function __construct($action, $url, array $attributes = [], $disabled = false) |
|
37 | |||
38 | /* ----------------------------------------------------------------- |
||
39 | | Getters & Setters |
||
40 | | ----------------------------------------------------------------- |
||
41 | */ |
||
42 | /** |
||
43 | * Set the link url. |
||
44 | * |
||
45 | * @param string $url |
||
46 | * |
||
47 | * @return \Arcanesoft\Core\Helpers\UI\Link |
||
48 | */ |
||
49 | 54 | public function setUrl($url) |
|
55 | |||
56 | /* ----------------------------------------------------------------- |
||
57 | | Main Methods |
||
58 | | ----------------------------------------------------------------- |
||
59 | */ |
||
60 | /** |
||
61 | * Make link instance. |
||
62 | * |
||
63 | * @param string $action |
||
64 | * @param string $url |
||
65 | * @param array $attributes |
||
66 | * @param bool $disabled |
||
67 | * |
||
68 | * @return self |
||
69 | */ |
||
70 | 54 | public static function make($action, $url, 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() |
|
111 | |||
112 | /** |
||
113 | * Get the value from config. |
||
114 | * |
||
115 | * @param string $key |
||
116 | * @param mixed $default |
||
117 | * |
||
118 | * @return mixed |
||
119 | */ |
||
120 | 54 | protected function getConfig($key, $default = null) |
|
124 | } |
||
125 |