Overview

Namespaces

  • DcGeneral
    • Clipboard
    • Contao
      • Callback
      • Compatibility
      • DataDefinition
        • Definition
      • Dca
        • Builder
          • Legacy
        • Definition
        • Palette
        • Populator
      • Event
      • View
        • Contao2BackendView
          • Event
    • Controller
    • Data
    • DataDefinition
      • Builder
      • Definition
        • Properties
        • View
          • Panel
      • ModelRelationship
      • Palette
        • Builder
          • Event
        • Condition
          • Palette
          • Property
    • EnvironmentPopulator
    • Event
    • Exception
    • Factory
      • Event
    • Panel
    • View
      • Event

Classes

  • BaseButtonEvent
  • BaseGetButtonsEvent
  • BuildWidgetEvent
  • DecodePropertyValueForWidgetEvent
  • EditModelBeforeSaveEvent
  • EncodePropertyValueFromWidgetEvent
  • GetBreadcrumbEvent
  • GetEditModeButtonsEvent
  • GetGlobalButtonEvent
  • GetGlobalButtonsEvent
  • GetGroupHeaderEvent
  • GetOperationButtonEvent
  • GetParentHeaderEvent
  • GetPasteButtonEvent
  • GetPasteRootButtonEvent
  • GetPropertyOptionsEvent
  • GetSelectModeButtonsEvent
  • ManipulateWidgetEvent
  • ModelToLabelEvent
  • ParentViewChildRecordEvent
  • ResolveWidgetErrorMessageEvent
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 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\Data\ModelInterface;
16: use DcGeneral\DataDefinition\Definition\Properties\PropertyInterface;
17: use DcGeneral\EnvironmentInterface;
18: use DcGeneral\Event\AbstractModelAwareEvent;
19: 
20: /**
21:  * Class BuildWidgetEvent.
22:  *
23:  * This event is being emitted when the widget manager wants to create a new widget instance.
24:  *
25:  * @package DcGeneral\Contao\View\Contao2BackendView\Event
26:  */
27: class BuildWidgetEvent
28:     extends AbstractModelAwareEvent
29: {
30:     /**
31:      * The name of the event.
32:      */
33:     const NAME = 'dc-general.view.contao2backend.build-widget';
34: 
35:     /**
36:      * The property for which a widget shall get instantiated.
37:      *
38:      * @var PropertyInterface
39:      */
40:     protected $property;
41: 
42:     /**
43:      * The instantiated widget.
44:      *
45:      * @var \Widget
46:      */
47:     protected $widget;
48: 
49:     /**
50:      * Create a new event.
51:      *
52:      * @param EnvironmentInterface $environment The environment instance in use.
53:      *
54:      * @param ModelInterface       $model       The model holding the data for the widget that shall be instantiated.
55:      *
56:      * @param PropertyInterface    $property    The property for which the widget shall be instantiated.
57:      */
58:     public function __construct(EnvironmentInterface $environment, ModelInterface $model, PropertyInterface $property)
59:     {
60:         parent::__construct($environment, $model);
61: 
62:         $this->property = $property;
63:     }
64: 
65:     /**
66:      * Stores the widget instance into the event.
67:      *
68:      * @param \Widget $widget The widget instance.
69:      *
70:      * @return BuildWidgetEvent
71:      */
72:     public function setWidget($widget)
73:     {
74:         $this->widget = $widget;
75: 
76:         return $this;
77:     }
78: 
79:     /**
80:      * Retrieve the widget instance from the event.
81:      *
82:      * @return \Widget
83:      */
84:     public function getWidget()
85:     {
86:         return $this->widget;
87:     }
88: 
89:     /**
90:      * Retrieve the property definition from the event for which the widget shall be instantiated.
91:      *
92:      * @return PropertyInterface
93:      */
94:     public function getProperty()
95:     {
96:         return $this->property;
97:     }
98: }
99: 
contao-community-alliance/dc-general API documentation generated by ApiGen 2.8.0