I have the following admin system setup using Sonata Admin in my SF2 project. When I click "View Image" I want to show either a popup/overlay with the image, or if it's easier, a new page with the image. The route for this is configured as /admin/ayrshireminis/gallery/galleryimage/{id}/view_image
I have this method in my CRUDController which the codepath enters:
/**
* 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));
}
How I can't find any Sonata documentation to work out howto simply display a blank page (within the Sonata Admin layout) with an image in it.