From 2889ab115a73024d3f0ff17f6e8ce0cd0bfc757c Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Wed, 15 Apr 2009 03:10:33 +0000 Subject: [PATCH] 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 --- forms/SimpleImageField.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/forms/SimpleImageField.php b/forms/SimpleImageField.php index 2caf1fe62..90e1d2fa3 100755 --- a/forms/SimpleImageField.php +++ b/forms/SimpleImageField.php @@ -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",