mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
elofgren: VAR FIX: Fix a large amount of undefined variable errors when creating and editing a 'newsletter subscription form' page by adding needed issets and initializations.
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41817 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
461f9e2af0
commit
e452de966c
@ -643,6 +643,7 @@ class DataObject extends Controller {
|
||||
public function getComponents($componentName, $filter = "", $sort = "", $join = "", $limit = "", $having = "") {
|
||||
// TODO Does not take different SQL-parameters into account on subsequent calls
|
||||
if(isset($this->componentCache[$componentName])) {
|
||||
if(isset($this->componentCache[$componentName]) && false != $this->componentCache[$componentName]) {
|
||||
return $this->componentCache[$componentName];
|
||||
}
|
||||
|
||||
@ -701,6 +702,7 @@ class DataObject extends Controller {
|
||||
foreach($allClasses as $class) {
|
||||
// if this class does a "has-one"-representation, use it
|
||||
if(isset($reversedComponentRelations[$class])) {
|
||||
if(isset($reversedComponentRelations[$class]) && false != $reversedComponentRelations[$class]) {
|
||||
$joinField = $reversedComponentRelations[$class] . 'ID';
|
||||
break;
|
||||
}
|
||||
@ -867,6 +869,7 @@ class DataObject extends Controller {
|
||||
|
||||
if($component) {
|
||||
$candidate = eval("return isset({$class}::\$has_many[\$component]) ? {$class}::\$has_many[\$component] : null;");
|
||||
$candidate = eval("if ( isset({$class}::\$has_many[\$component]) ) { return {$class}::\$has_many[\$component]; } else { return false; }");
|
||||
if($candidate) {
|
||||
return $candidate;
|
||||
}
|
||||
|
@ -65,8 +65,11 @@ class EditableFormField extends DataObject {
|
||||
$titleAttr = Convert::raw2att($this->Title);
|
||||
$readOnlyAttr = '';
|
||||
|
||||
if( $this->readonly )
|
||||
if( $this->readonly ) {
|
||||
$readOnlyAttr = ' disabled="disabled"';
|
||||
} else {
|
||||
$readOnlyAttr = '';
|
||||
}
|
||||
|
||||
return "<input type=\"text\" class=\"text\" title=\"(Enter Question)\" value=\"$titleAttr\" name=\"Fields[{$this->ID}][Title]\"$readOnlyAttr />";
|
||||
}
|
||||
@ -158,7 +161,7 @@ class EditableFormField extends DataObject {
|
||||
foreach( $paramList as $param ) {
|
||||
|
||||
if( preg_match( '/([^=]+)=(.+)/', $param, $match ) ) {
|
||||
if( is_array( $paramMap[$match[1]] ) ) {
|
||||
if( isset( $paramMap[$match[1]] ) && is_array( $paramMap[$match[1]] ) ) {
|
||||
$paramMap[$match[1]][] = $match[2];
|
||||
} else if( isset( $paramMap[$match[1]] ) ) {
|
||||
$paramMap[$match[1]] = array( $paramMap[$match[1]] );
|
||||
|
@ -72,8 +72,11 @@
|
||||
function DefaultSelect() {
|
||||
$disabled = ($this->readonly) ? " disabled=\"disabled\"" : '';
|
||||
|
||||
if($this->Parent()->getField('Default') == $this->ID)
|
||||
if($this->Parent()->getField('Default') == $this->ID) {
|
||||
$default = " checked=\"checked\"";
|
||||
} else {
|
||||
$default = '';
|
||||
}
|
||||
|
||||
return "<input class=\"radio\" type=\"radio\" name=\"Fields[{$this->ParentID}][Default]\" value=\"{$this->ID}\"".$disabled.$default." />";
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ class EditableTextField extends EditableFormField {
|
||||
$disabled = '';
|
||||
if( $this->readonly ){
|
||||
$disabled = " disabled=\"disabled\"";
|
||||
} else {
|
||||
$disabled = '';
|
||||
}
|
||||
if( $this->Rows == 1 ){
|
||||
return '<div class="field text"><label class="left">Default Text </label> <input class="defaultText" name="Fields['.Convert::raw2att( $this->ID ).'][Default]" type="text" value="'.Convert::raw2att( $this->getField('Default') ).'"'.$disabled.' /></div>';
|
||||
|
Loading…
Reference in New Issue
Block a user