【发布时间】:2023-03-08 01:27:01
【问题描述】:
我在我的 SF2 项目中使用 Sonata Admin 进行了以下管理系统设置。当我单击“查看图像”时,我想显示带有图像的弹出窗口/叠加层,或者如果更简单,则显示带有图像的新页面。这个路由配置为/admin/ayrshireminis/gallery/galleryimage/{id}/view_image
我在代码路径输入的 CRUDController 中有这个方法:
/**
* preview the image
*
* @return RedirectResponse
*/
public function viewImageAction()
{
// work out which image we are approving based on the ID in the URL
$id = $this->get('request')->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);
// couldn't find the object
if (!$object) {
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
}
return $this->render('SonataAdminBundle::empty_layout.html.twig', array('image' => $object));
}
我怎么找不到任何 Sonata 文档来解决如何简单地显示一个包含图像的空白页面(在 Sonata Admin 布局中)。
【问题讨论】:
标签: php symfony php-5.3 sonata-admin sonata