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\EnvironmentInterface;
16: use DcGeneral\Event\AbstractEnvironmentAwareEvent;
17:
18: /**
19: * Class ResolveWidgetErrorMessageEvent.
20: *
21: * This event gets emitted when the error message of a widget shall get resolved.
22: *
23: * @package DcGeneral\Contao\View\Contao2BackendView\Event
24: */
25: class ResolveWidgetErrorMessageEvent
26: extends AbstractEnvironmentAwareEvent
27: {
28: const NAME = 'dc-general.view.widget.resolve-error-message';
29:
30: /**
31: * The error message.
32: *
33: * @var mixed
34: */
35: protected $error;
36:
37: /**
38: * Create a new instance of the event.
39: *
40: * @param EnvironmentInterface $environment The environment in use.
41: *
42: * @param string $error The error message.
43: */
44: public function __construct(EnvironmentInterface $environment, $error)
45: {
46: parent::__construct($environment);
47: $this->error = $error;
48: }
49:
50: /**
51: * Set the error message.
52: *
53: * @param mixed $error The error message.
54: *
55: * @return ResolveWidgetErrorMessageEvent
56: */
57: public function setError($error)
58: {
59: $this->error = $error;
60: return $this;
61: }
62:
63: /**
64: * Retrieve the error message.
65: *
66: * @return mixed
67: */
68: public function getError()
69: {
70: return $this->error;
71: }
72: }
73: