Merge pull request #6 from tractorcow/3.0-set-option-failure-fix

BUG Error setting options on Null defaults
This commit is contained in:
Thierry Francois 2012-11-23 00:19:17 -08:00
commit beb1d46aa6
2 changed files with 30 additions and 28 deletions

View File

@ -53,8 +53,10 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
*/ */
function setConfig ( $reference, $value ) function setConfig ( $reference, $value )
{ {
if ( isset( $this->config[$reference] ) ) if (!key_exists($reference, $this->config) ) {
{ user_error("Unknown option reference: $reference", E_USER_ERROR);
}
if ( ($reference == 'fieldsClassBlacklist' || $reference == 'fieldsClassBlacklist' || $reference == 'editableFields') && !is_array($value) ) if ( ($reference == 'fieldsClassBlacklist' || $reference == 'fieldsClassBlacklist' || $reference == 'editableFields') && !is_array($value) )
{ {
$value = array($value); $value = array($value);
@ -68,7 +70,6 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
$this->config[$reference] = $value; $this->config[$reference] = $value;
} }
}
/** /**
* Returns one $config parameter of the full $config * Returns one $config parameter of the full $config

View File

@ -44,8 +44,10 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
*/ */
function setConfig ( $reference, $value ) function setConfig ( $reference, $value )
{ {
if ( isset( $this->config[$reference] ) ) if (!key_exists($reference, $this->config) ) {
{ user_error("Unknown option reference: $reference", E_USER_ERROR);
}
if ( ($reference == 'fieldsClassBlacklist' || $reference == 'fieldsClassBlacklist' || $reference == 'editableFields') && !is_array($value) ) if ( ($reference == 'fieldsClassBlacklist' || $reference == 'fieldsClassBlacklist' || $reference == 'editableFields') && !is_array($value) )
{ {
$value = array($value); $value = array($value);
@ -59,7 +61,6 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
$this->config[$reference] = $value; $this->config[$reference] = $value;
} }
}
/** /**
* Returns one $config parameter of the full $config * Returns one $config parameter of the full $config