BUGFIX: add more condition before $this->form is used as Caller since $this->form can still not be set yet in a certain circumstance.

ENHANCEMENT: add the ability that a SimpleImageField could be disabled.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@74489 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Normann Lou 2009-04-15 03:10:33 +00:00 committed by Sam Minnee
parent d78fecdfe6
commit 2889ab115a

View File

@ -24,9 +24,9 @@ class SimpleImageField extends FileField {
public $allowedExtensions = array('jpg','gif','png');
function Field() {
$record = $this->form->getRecord();
if($this->form) $record = $this->form->getRecord();
$fieldName = $this->name;
if($record) {
if(isset($record)&&$record) {
$imageField = $record->$fieldName();
} else {
$imageField = "";
@ -47,7 +47,8 @@ class SimpleImageField extends FileField {
"type" => "file",
"name" => $this->name,
"id" => $this->id(),
"tabindex" => $this->getTabIndex()
"tabindex" => $this->getTabIndex(),
'disabled' => $this->disabled
)
);
$html .= $this->createTag("input",