如何在symfony集合图像中获取图像预览

时间:2014-07-01 07:41:59

标签: jquery html5 doctrine-orm symfony-2.3 php-5.4

我在一个symfony2项目中使用SonataAdminBundle,我的管理类如下所示:

class ApartmentsAdmin extends Admin
 {
     protected function configureFormFields(FormMapper $formMapper)
      {
         ->add('images', 'collection', array(
                'type' => new ImageType(),
                'allow_add' => true,
                'allow_delete' => true,
                'by_reference' => true,
                'mapped' => true,
                'label' => false,
                'required' => false,
                'label' => 'Apartment Images'
              ));
           }
       }

工作正常;但我的问题是,在编辑页面上,我想让我们看看图像集合中包含的每个图像的预览。在“SonataAdminBundle”的文档中,为一个单独的图像提供了图像预览,但是如何对集合图像进行预览..

请建议我..

非常感谢..

1 个答案:

答案 0 :(得分:0)

最后,我可以通过“自定义表单类型扩展”执行此操作,其中的文档在“http://symfony.com/doc/current/cookbook/form/create_form_type_extension.html”链接上提供。