Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Reformatted GridFieldDataColumns->castValue and added missing assignm…

…ent.
  • Loading branch information...
commit 13bf61d402e4d9ea6d1a3106ff68a8fe0f437a2e 1 parent 9c4e474
@jakr jakr authored
Showing with 11 additions and 10 deletions.
  1. +11 −10 forms/gridfield/GridFieldDataColumns.php
View
21 forms/gridfield/GridFieldDataColumns.php
@@ -212,16 +212,17 @@ protected function castValue($gridField, $fieldName, $value) {
// If a fieldCasting is specified, we assume the result is safe
if(array_key_exists($fieldName, $this->fieldCasting)) {
$value = $gridField->getCastedValue($value, $this->fieldCasting[$fieldName]);
- }
- // If the value is an object, we do one of two things
- else if(is_object($value)) {
- // If it has a "Nice" method, call that & make sure the result is safe
- if (method_exists($value, 'Nice')) Convert::raw2xml($value->Nice());
- // Otherwise call forTemplate - the result of this should already be safe
- else $value = $value->forTemplate();
- }
- // Otherwise, just treat as a text string & make sure the result is safe
- else {
+ } else if(is_object($value)) {
+ // If the value is an object, we do one of two things
+ if (method_exists($value, 'Nice')) {
+ // If it has a "Nice" method, call that & make sure the result is safe
+ $value = Convert::raw2xml($value->Nice());
+ } else {
+ // Otherwise call forTemplate - the result of this should already be safe
+ $value = $value->forTemplate();
+ }
+ } else {
+ // Otherwise, just treat as a text string & make sure the result is safe
$value = Convert::raw2xml($value);
}
Please sign in to comment.
Something went wrong with that request. Please try again.