1 | <?php |
||
24 | class Upload extends WidgetBase { |
||
25 | |||
26 | /** |
||
27 | * The module handler service. |
||
28 | * |
||
29 | * @var \Drupal\Core\Extension\ModuleHandlerInterface |
||
30 | */ |
||
31 | protected $moduleHandler; |
||
32 | |||
33 | /** |
||
34 | * The token service. |
||
35 | * |
||
36 | * @var \Drupal\Core\Utility\Token |
||
37 | */ |
||
38 | protected $token; |
||
39 | |||
40 | /** |
||
41 | * Upload constructor. |
||
42 | * |
||
43 | * @param array $configuration |
||
44 | * A configuration array containing information about the plugin instance. |
||
45 | * @param string $plugin_id |
||
46 | * The plugin_id for the plugin instance. |
||
47 | * @param mixed $plugin_definition |
||
48 | * The plugin implementation definition. |
||
49 | * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher |
||
50 | * Event dispatcher service. |
||
51 | * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager |
||
52 | * The entity type manager service. |
||
53 | * @param \Drupal\entity_browser\WidgetValidationManager $validation_manager |
||
54 | * The Widget Validation Manager service. |
||
55 | * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler |
||
56 | * The module handler. |
||
57 | * @param \Drupal\Core\Utility\Token $token |
||
58 | * The token service. |
||
59 | */ |
||
60 | public function __construct(array $configuration, $plugin_id, $plugin_definition, EventDispatcherInterface $event_dispatcher, EntityTypeManagerInterface $entity_type_manager, WidgetValidationManager $validation_manager, ModuleHandlerInterface $module_handler, Token $token) { |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | public function defaultConfiguration() { |
||
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters) { |
||
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | protected function prepareEntities(FormStateInterface $form_state) { |
||
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | */ |
||
121 | public function submit(array &$element, array &$form, FormStateInterface $form_state) { |
||
126 | |||
127 | /** |
||
128 | * Clear values from upload form element. |
||
129 | * |
||
130 | * @param array $element |
||
131 | * Upload form element. |
||
132 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
133 | * Form state object. |
||
134 | */ |
||
135 | protected function clearFormValues(array &$element, FormStateInterface $form_state) { |
||
141 | |||
142 | /** |
||
143 | * @param FormStateInterface $form_state |
||
144 | * Form state object. |
||
145 | * |
||
146 | * @return \Drupal\file\FileInterface[] |
||
147 | * Array of files. |
||
148 | */ |
||
149 | protected function extractFiles(FormStateInterface $form_state) { |
||
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | public function buildConfigurationForm(array $form, FormStateInterface $form_state) { |
||
182 | |||
183 | } |
||
184 |