| Conditions | 7 | 
| Paths | 4 | 
| Total Lines | 23 | 
| Code Lines | 17 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 20 | protected function configureFormFields(FormMapper $formMapper) | ||
| 21 |     { | ||
| 22 | $media = $this->getSubject() ? $this->getSubject()->getMedia() : null; | ||
| 23 | |||
| 24 | $help = null; | ||
| 25 |         if ($media && $media->getMedia() && false !== strpos($media->getMimeType(), 'image/')) { | ||
| 26 | $fullPath = '/'.$media->getRelativeDir().'/'.$media->getMedia(); | ||
| 27 | $thumb = $this->liipImage->getBrowserPath($fullPath, 'small_thumb'); | ||
|  | |||
| 28 | $help = '<a href="'.$this->liipImage->getBrowserPath($fullPath, 'default').'">'; | ||
| 29 | $help .= '<img src="'.$this->liipImage->getBrowserPath($fullPath, 'small_thumb').'">'; | ||
| 30 | $help .= '</a>'; | ||
| 31 | } | ||
| 32 | |||
| 33 | $formMapper | ||
| 34 |             ->add('media', ModelListType::class, [ | ||
| 35 | 'required' => false, | ||
| 36 | 'btn_delete' => false, | ||
| 37 | 'btn_edit' => false, | ||
| 38 | 'btn_add' => (!$media) ? ' ' : false, | ||
| 39 | 'btn_list' => (!$media) ? ' ' : false, | ||
| 40 | 'sonata_help' => $help, | ||
| 41 | ]) | ||
| 42 |             ->add('position', HiddenType::class) | ||
| 43 | ; | ||
| 54 |