1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\Contao\View\Contao2BackendView\Event;
14:
15: use DcGeneral\Event\AbstractEnvironmentAwareEvent;
16:
17: /**
18: * Class BaseButtonEvent.
19: *
20: * This event is the base for all button events for the Contao 2 backend view.
21: *
22: * @package DcGeneral\Contao\View\Contao2BackendView\Event
23: */
24: class BaseButtonEvent
25: extends AbstractEnvironmentAwareEvent
26: {
27: /**
28: * The name of the event.
29: */
30: const NAME = 'dc-general.view.contao2backend.button';
31:
32: /**
33: * The html attributes to use for the button.
34: *
35: * @var string
36: */
37: protected $attributes;
38:
39: /**
40: * The Html code to use for this button.
41: *
42: * @var string
43: */
44: protected $html;
45:
46: /**
47: * The key/name of the button.
48: *
49: * @var string
50: */
51: protected $key;
52:
53: /**
54: * The label to use for the button.
55: *
56: * @var string
57: */
58: protected $label;
59:
60: /**
61: * The title to use for the button.
62: *
63: * @var string
64: */
65: protected $title;
66:
67: /**
68: * Set the HTML attributes for the button.
69: *
70: * This might be a string like: 'onclick="foo" style="float:left;"' etc.
71: *
72: * @param string $attributes The attributes to be used.
73: *
74: * @return $this
75: */
76: public function setAttributes($attributes)
77: {
78: $this->attributes = $attributes;
79:
80: return $this;
81: }
82:
83: /**
84: * Get the HTML attributes for the button.
85: *
86: * @return string
87: */
88: public function getAttributes()
89: {
90: return $this->attributes;
91: }
92:
93: /**
94: * Set the HTML code for the button.
95: *
96: * @param string $html The HTML code.
97: *
98: * @return $this
99: */
100: public function setHtml($html)
101: {
102: $this->html = $html;
103:
104: return $this;
105: }
106:
107: /**
108: * Get the HTML code for the button.
109: *
110: * @return string
111: */
112: public function getHtml()
113: {
114: return $this->html;
115: }
116:
117: /**
118: * Set the key/name for the button.
119: *
120: * @param string $key The key/name to use.
121: *
122: * @return $this
123: */
124: public function setKey($key)
125: {
126: $this->key = $key;
127:
128: return $this;
129: }
130:
131: /**
132: * Get the action key/name for the button.
133: *
134: * @return string
135: */
136: public function getKey()
137: {
138: return $this->key;
139: }
140:
141: /**
142: * Set the button label text.
143: *
144: * @param string $label The label text to use.
145: *
146: * @return $this
147: */
148: public function setLabel($label)
149: {
150: $this->label = $label;
151:
152: return $this;
153: }
154:
155: /**
156: * Get the button label text.
157: *
158: * @return string
159: */
160: public function getLabel()
161: {
162: return $this->label;
163: }
164:
165: /**
166: * Set the button title.
167: *
168: * @param string $title The title text.
169: *
170: * @return $this
171: */
172: public function setTitle($title)
173: {
174: $this->title = $title;
175:
176: return $this;
177: }
178:
179: /**
180: * Get the button title.
181: *
182: * @return string
183: */
184: public function getTitle()
185: {
186: return $this->title;
187: }
188: }
189: