Version 1
[yaffs-website] / web / modules / contrib / entity_browser / src / Events / AlterEntityBrowserDisplayData.php
1 <?php
2
3 namespace Drupal\entity_browser\Events;
4
5 use Drupal\Core\Form\FormStateInterface;
6
7 /**
8  * Allows data for an entity browser element to be altered.
9  */
10 class AlterEntityBrowserDisplayData extends EventBase {
11
12   /**
13    * Data to process.
14    *
15    * @var array
16    */
17   protected $data;
18
19   /**
20    * Form state object.
21    *
22    * @var \Drupal\Core\Form\FormStateInterface
23    */
24   protected $formState;
25
26   /**
27    * Plugin definition.
28    *
29    * @var array
30    */
31   protected $pluginDefinition;
32
33   /**
34    * Constructs a EntitySelectionEvent object.
35    *
36    * @param string $entity_browser_id
37    *   Entity browser ID.
38    * @param string $instance_uuid
39    *   Entity browser instance UUID.
40    * @param array $plugin_definition
41    *   Plugin definition.
42    * @param \Drupal\Core\Form\FormStateInterface $form_state
43    *   Form state object.
44    * @param array $data
45    *   Data to process.
46    */
47   public function __construct($entity_browser_id, $instance_uuid, array $plugin_definition, FormStateInterface $form_state, array $data) {
48     parent::__construct($entity_browser_id, $instance_uuid);
49     $this->data = $data;
50     $this->formState = $form_state;
51     $this->pluginDefinition = $plugin_definition;
52   }
53
54   /**
55    * Gets form state.
56    *
57    * @return \Drupal\Core\Form\FormStateInterface
58    *   Form state object.
59    */
60   public function getFormState() {
61     return $this->formState;
62   }
63
64   /**
65    * Gets data array.
66    *
67    * @return array
68    *   Data array.
69    */
70   public function getData() {
71     return $this->data;
72   }
73
74   /**
75    * Gets plugin definition array.
76    *
77    * @return array
78    *   Plugin definition array.
79    */
80   public function getPluginDefinition() {
81     return $this->pluginDefinition;
82   }
83
84   /**
85    * Sets data array.
86    *
87    * @param array $data
88    *   Data array.
89    */
90   public function setData($data) {
91     $this->data = $data;
92   }
93
94 }