Skip to content

Commit

Permalink
add association Admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilien committed Jul 23, 2023
1 parent 7c49969 commit 69b52bf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Block/MediaBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Sonata\MediaBundle\Model\MediaInterface;
use Sonata\MediaBundle\Model\MediaManagerInterface;
use Sonata\MediaBundle\Provider\Pool;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
Expand Down Expand Up @@ -204,11 +205,17 @@ private function getMediaBuilder(): FormBuilderInterface
'edit' => 'list',
]);

return $this->mediaAdmin->getFormBuilder()->create('mediaId', ModelListType::class, [
$fieldDescription->setAssociationAdmin($this->mediaAdmin);

$formBuilder = $this->mediaAdmin->getFormBuilder()->create('mediaId', ModelListType::class, [
'sonata_field_description' => $fieldDescription,
'class' => $this->mediaAdmin->getClass(),
'model_manager' => $this->mediaAdmin->getModelManager(),
'label' => 'form.label_media',
]);

// Add ModelTransformer ?
return $formBuilder;
}
}

0 comments on commit 69b52bf

Please sign in to comment.