[TASK] Unsplit the splitbutton
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Template / Components / Buttons / AbstractButton.php
1 <?php
2 namespace TYPO3\CMS\Backend\Template\Components\Buttons;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Backend\Template\Components\AbstractControl;
18 use TYPO3\CMS\Core\Imaging\Icon;
19
20 /**
21 * AbstractButton
22 */
23 class AbstractButton extends AbstractControl implements ButtonInterface
24 {
25 /**
26 * Icon object
27 *
28 * @var Icon
29 */
30 protected $icon;
31
32 /**
33 * ButtonType
34 *
35 * @var string
36 */
37 protected $type;
38
39 /**
40 * Defines whether to show the title as a label within the button
41 *
42 * @var bool
43 */
44 protected $showLabelText = false;
45
46 /**
47 * Disabled state of the button
48 *
49 * @var bool
50 */
51 protected $disabled = false;
52
53 /**
54 * Show Label text
55 *
56 * @return bool
57 */
58 public function getShowLabelText()
59 {
60 return $this->showLabelText;
61 }
62
63 /**
64 * Show Label text
65 *
66 * @param bool $showLabelText
67 *
68 * @return $this
69 */
70 public function setShowLabelText($showLabelText)
71 {
72 $this->showLabelText = $showLabelText;
73 return $this;
74 }
75
76 /**
77 * Get icon
78 *
79 * @return Icon
80 */
81 public function getIcon()
82 {
83 return $this->icon;
84 }
85
86 /**
87 * Get type
88 *
89 * @return string
90 */
91 public function getType()
92 {
93 return static::class;
94 }
95
96 /**
97 * Set icon
98 *
99 * @param Icon $icon Icon object for the button
100 *
101 * @return $this
102 */
103 public function setIcon(Icon $icon)
104 {
105 $this->icon = $icon;
106 return $this;
107 }
108
109 /**
110 * Check if button is disabled
111 *
112 * @return bool
113 */
114 public function isDisabled(): bool
115 {
116 return $this->disabled;
117 }
118
119 /**
120 * Set if button needs to be disabled
121 *
122 * @param bool $disabled
123 * @return AbstractButton
124 */
125 public function setDisabled(bool $disabled): AbstractButton
126 {
127 $this->disabled = $disabled;
128 return $this;
129 }
130
131 /**
132 * Implementation from ButtonInterface
133 * This object is an abstract, so no implementation is necessary
134 *
135 * @return bool
136 */
137 public function isValid()
138 {
139 return false;
140 }
141
142 /**
143 * Implementation from ButtonInterface
144 * This object is an abstract, so no implementation is necessary
145 *
146 * @return string
147 */
148 public function __toString()
149 {
150 return '';
151 }
152
153 /**
154 * Implementation from ButtonInterface
155 * This object is an abstract, so no implementation is necessary
156 *
157 * @return string
158 */
159 public function render()
160 {
161 return '';
162 }
163 }