File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Ayacoo \VideoValidator \Event ;
6+
7+ use TYPO3 \CMS \Core \Resource \FileInterface ;
8+
9+ final class ModifyVideoValidateEvent
10+ {
11+ public function __construct (
12+ private readonly ?FileInterface $ file ,
13+ private readonly array $ properties = [],
14+ ) {
15+ }
16+
17+ public function getFile (): ?FileInterface
18+ {
19+ return $ this ->file ;
20+ }
21+
22+ public function getProperties (): array
23+ {
24+ return $ this ->properties ;
25+ }
26+ }
Original file line number Diff line number Diff line change 77use Ayacoo \VideoValidator \Domain \Dto \ValidatorDemand ;
88use Ayacoo \VideoValidator \Domain \Repository \FileRepository ;
99use Ayacoo \VideoValidator \Event \ModifyValidatorEvent ;
10+ use Ayacoo \VideoValidator \Event \ModifyVideoValidateEvent ;
1011use Ayacoo \VideoValidator \Service \Validator \AbstractVideoValidatorInterface ;
1112use Ayacoo \VideoValidator \Service \Validator \VimeoValidator ;
1213use Ayacoo \VideoValidator \Service \Validator \YoutubeValidator ;
@@ -130,6 +131,11 @@ public function validate(ValidatorDemand $validatorDemand): void
130131 );
131132
132133 $ this ->fileRepository ->updatePropertiesByFile ($ video ['uid ' ], $ properties );
134+
135+ // You want a special action after validation? Have a look at the documentation!
136+ $ event = new ModifyVideoValidateEvent ($ file , $ properties );
137+ $ this ->eventDispatcher ->dispatch ($ event );
138+
133139 $ this ->io ->progressAdvance (1 );
134140 }
135141 $ this ->io ->progressFinish ();
Original file line number Diff line number Diff line change @@ -400,7 +400,46 @@ class YourReportService implements AbstractReportServiceInterface
400400
401401```
402402
403- ### 5.4 Email settings
403+ ### 5.4 Register your custom validate action
404+
405+ It is also possible to register your own actions during validation. For example,
406+ You can disable referenced content items.
407+
408+ ### EventListener registration
409+
410+ ```
411+ services:
412+ Extension\Namespace\Listener\VideoValidateListener:
413+ tags:
414+ - name: event.listener
415+ identifier: 'extensionkey/videovalidator'
416+ event: Ayacoo\VideoValidator\Event\ModifyVideoValidateEvent
417+ ```
418+
419+ ### EventListener
420+
421+ ```
422+ <?php
423+ declare(strict_types=1);
424+
425+ namespace Extension\Namespace\Listener;
426+
427+ use Ayacoo\VideoValidator\Event\ModifyVideoValidateEvent;
428+ use TYPO3\CMS\Core\Utility\GeneralUtility;
429+
430+ class VideoValidateListener
431+ {
432+ public function dispatch(ModifyVideoValidateEvent $event): void
433+ {
434+ $file = $event->getFile();
435+ $properties = $event->getProperties();
436+ // Do your custom stuff e.g. custom action
437+ }
438+ }
439+
440+ ```
441+
442+ ### 5.5 Email settings
404443
405444To define a sender for the email, the
406445configuration ``` $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'] ```
You can’t perform that action at this time.
0 commit comments