Conditions | 5 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
39 | public function uploadImage(ResourceControllerEvent $event): void |
||
40 | { |
||
41 | $block = $event->getSubject(); |
||
42 | |||
43 | Assert::isInstanceOf($block,BlockInterface::class); |
||
44 | |||
45 | if (BlockInterface::IMAGE_BLOCK_TYPE !== $block->getType()) { |
||
46 | return; |
||
47 | } |
||
48 | |||
49 | /** @var BlockTranslationInterface $translation */ |
||
50 | foreach ($block->getTranslations() as $translation) { |
||
51 | $image = $translation->getImage(); |
||
52 | |||
53 | if (null !== $image && true === $image->hasFile()) { |
||
54 | $this->uploader->upload($image); |
||
55 | } |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 |