|
@@ -52,18 +52,18 @@ we are manipulating form fields we do this from within ``ImageAdmin::configureFo
|
|
|
{
|
|
|
// get the current Image instance
|
|
|
$image = $this->getSubject();
|
|
|
-
|
|
|
+
|
|
|
// use $fileFieldOptions so we can add other options to the field
|
|
|
$fileFieldOptions = array('required' => false);
|
|
|
if ($image && ($webPath = $image->getWebPath())) {
|
|
|
// get the container so the full path to the image can be set
|
|
|
$container = $this->getConfigurationPool()->getContainer();
|
|
|
$fullPath = $container->get('request')->getBasePath().'/'.$webPath;
|
|
|
-
|
|
|
+
|
|
|
// add a 'help' option containing the preview's img tag
|
|
|
$fileFieldOptions['help'] = '<img src="'.$fullPath.'" class="admin-preview" />';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$formMapper
|
|
|
// ... other fields ...
|
|
|
->add('file', 'file', $fileFieldOptions)
|
|
@@ -113,14 +113,14 @@ Admin class is embedded and use a different method:
|
|
|
} else {
|
|
|
$image = $this->getSubject();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// use $fileFieldOptions so we can add other options to the field
|
|
|
$fileFieldOptions = array('required' => false);
|
|
|
if ($image && ($webPath = $image->getWebPath())) {
|
|
|
// add a 'help' option containing the preview's img tag
|
|
|
$fileFieldOptions['help'] = '<img src="'.$webPath.'" class="admin-preview" />';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$formMapper
|
|
|
// ... other fields ...
|
|
|
->add('file', 'file', $fileFieldOptions)
|