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\AbstractModelAwareEvent;
16:
17: /**
18: * Class GetPropertyOptionsEvent.
19: *
20: * This event gets emitted when the options for a property shall get retrieved for the edit view.
21: *
22: * @package DcGeneral\Contao\View\Contao2BackendView\Event
23: */
24: class GetPropertyOptionsEvent
25: extends AbstractModelAwareEvent
26: {
27: const NAME = 'dc-general.view.contao2backend.get-property-options';
28:
29: /**
30: * The name of the property to retrieve the options for.
31: *
32: * @var string
33: */
34: protected $propertyName;
35:
36: /**
37: * The options for the properties.
38: *
39: * @var array
40: */
41: protected $options;
42:
43: /**
44: * Set the property name to retrieve the options for.
45: *
46: * @param string $propertyName The name of the property.
47: *
48: * @return $this
49: *
50: * @deprecated this method has been renamed to setPropertyName.
51: */
52: public function setFieldName($propertyName)
53: {
54: return $this->setPropertyName($propertyName);
55: }
56:
57: /**
58: * Get the property name to retrieve the options for.
59: *
60: * @return string
61: *
62: * @deprecated this method has been renamed to getPropertyName.
63: */
64: public function getFieldName()
65: {
66: return $this->getPropertyName();
67: }
68:
69: /**
70: * Set the property name to retrieve the options for.
71: *
72: * @param string $propertyName The name of the property.
73: *
74: * @return $this
75: */
76: public function setPropertyName($propertyName)
77: {
78: $this->propertyName = $propertyName;
79:
80: return $this;
81: }
82:
83: /**
84: * Get the property name to retrieve the options for.
85: *
86: * @return string
87: */
88: public function getPropertyName()
89: {
90: return $this->propertyName;
91: }
92:
93: /**
94: * Set the options for the property in the event.
95: *
96: * @param array $options The options.
97: *
98: * @return $this
99: */
100: public function setOptions($options)
101: {
102: $this->options = $options;
103:
104: return $this;
105: }
106:
107: /**
108: * Retrieve the options for the property from the event.
109: *
110: * @return array
111: */
112: public function getOptions()
113: {
114: return $this->options;
115: }
116: }
117: