MINOR: Formatted code a little better, at Stig's request.

This commit is contained in:
Sam Minnee 2012-03-09 10:04:25 +13:00
parent 5800db0239
commit 7ea151789b

View File

@ -352,13 +352,19 @@ class GridField extends FormField {
// If the fragment still has a fragment definition in it, when we should defer this item until later. // If the fragment still has a fragment definition in it, when we should defer this item until later.
if(preg_match('/\$DefineFragment\(([a-z0-9\-_]+)\)/i', $fragment, $matches)) { if(preg_match('/\$DefineFragment\(([a-z0-9\-_]+)\)/i', $fragment, $matches)) {
// If we've already deferred this fragment, then we have a circular dependency // If we've already deferred this fragment, then we have a circular dependency
if(isset($fragmentDeferred[$k]) && $fragmentDeferred[$k] > 5) throw new LogicException("GridField HTML fragment '$fragmentName' and '$matches[1]' appear to have a circular dependency."); if(isset($fragmentDeferred[$k]) && $fragmentDeferred[$k] > 5) {
throw new LogicException("GridField HTML fragment '$fragmentName' and '$matches[1]' " .
"appear to have a circular dependency.");
}
// Otherwise we can push to the end of the content array // Otherwise we can push to the end of the content array
unset($content[$k]); unset($content[$k]);
$content[$k] = $v; $content[$k] = $v;
if(!isset($fragmentDeferred[$k])) $fragmentDeferred[$k] = 1; if(!isset($fragmentDeferred[$k])) {
else $fragmentDeferred[$k]++; $fragmentDeferred[$k] = 1;
} else {
$fragmentDeferred[$k]++;
}
break; break;
} else { } else {
$content[$k] = preg_replace('/\$DefineFragment\(' . $fragmentName . '\)/i', $fragment, $content[$k]); $content[$k] = preg_replace('/\$DefineFragment\(' . $fragmentName . '\)/i', $fragment, $content[$k]);