Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Allowing HTML values in SimpleImageField_Readonly in order to a…

…llow image-based diffs
  • Loading branch information...
commit 6e1013e93b6f2f335959b01346c23d3d4051b21a 1 parent 4d31ac6
@chillu chillu authored
Showing with 15 additions and 8 deletions.
  1. +15 −8 forms/SimpleImageField.php
View
23 forms/SimpleImageField.php
@@ -137,16 +137,23 @@ class SimpleImageField_Disabled extends FormField {
function Field() {
$record = $this->form->getRecord();
$fieldName = $this->name;
- if($record) $imageField = $record->$fieldName();
+
$field = "<div class=\"simpleimage\">";
- if($imageField && $imageField->exists()) {
- if($imageField->hasMethod('Thumbnail')) $field .= "<img src=\"".$imageField->Thumbnail()->URL."\" />";
- elseif($imageField->CMSThumbnail()) $field .= "<img src=\"".$imageField->CMSThumbnail()->URL."\" />";
- else {} // This shouldn't be called but it sometimes is for some reason, so we don't do anything
- }else{
- $field .= "<label>" . _t('SimpleImageField.NOUPLOAD', 'No Image Uploaded') . "</label>";
- }
+ if($this->value) {
+ // Only the case for DataDifferencer
+ $field .= $this->value;
+ } else {
+ if($record) $imageField = $record->$fieldName();
+ if($imageField && $imageField->exists()) {
+ if($imageField->hasMethod('Thumbnail')) $field .= "<img src=\"".$imageField->Thumbnail()->URL."\" />";
+ elseif($imageField->CMSThumbnail()) $field .= "<img src=\"".$imageField->CMSThumbnail()->URL."\" />";
+ else {} // This shouldn't be called but it sometimes is for some reason, so we don't do anything
+ }else{
+ $field .= "<label>" . _t('SimpleImageField.NOUPLOAD', 'No Image Uploaded') . "</label>";
+ }
+ }
$field .= "</div>";
+
return $field;
}
Please sign in to comment.
Something went wrong with that request. Please try again.