File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -233,34 +233,24 @@ final class FooAddForm extends AbstractFormBuilderForm
233233 FileProcessorFormField::create('imageID')
234234 ->singleFileUpload()
235235 ->required()
236- ->context($this->getContent())
237236 ->objectType('foo.bar.image')
238237 ]),
239238 ]);
240239 }
241-
242- protected function getContent(): array
243- {
244- if ($this->formObject !== null) {
245- return [
246- 'fooID' => $this->formObject->fooID,
247- ];
248- }
249-
250- return [];
251- }
252240}
253241```
254242
255243#### Example for implementing an ` IFileProcessor `
256244
245+ The ` objectID ` in the ` $context ` comes from the form and corresponds to the objectID of the ` FooAddForm::$formObject ` .
246+
257247``` PHP
258248final class FooImageFileProcessor extends AbstractFileProcessor
259249{
260250 #[\Override]
261251 public function acceptUpload(string $filename, int $fileSize, array $context): FileProcessorPreflightResult
262252 {
263- if (isset($context['fooID '])) {
253+ if (isset($context['objectID '])) {
264254 $foo = $this->getFoo($context);
265255 if ($foo === null) {
266256 return FileProcessorPreflightResult::InvalidContext;
You can’t perform that action at this time.
0 commit comments