mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +00:00
ENHANCEMENT Removed CMSMain->jsDeclaration(), it was replicating functionality already present in Convert::raw2js()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92671 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8b89a265da
commit
b99ee16d88
@ -197,7 +197,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
}
|
||||
|
||||
// Put data hints into a script tag at the top
|
||||
Requirements::customScript("siteTreeHints = " . $this->jsDeclaration($def) . ";");
|
||||
Requirements::customScript("siteTreeHints = " . Convert::raw2json($def) . ";");
|
||||
}
|
||||
|
||||
public function generateTreeStylingJS() {
|
||||
@ -238,33 +238,6 @@ JS;
|
||||
Requirements::customScript($js);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a javascript instanciation of this array
|
||||
*/
|
||||
protected function jsDeclaration($array) {
|
||||
if(is_array($array)) {
|
||||
$object = false;
|
||||
foreach(array_keys($array) as $key) {
|
||||
if(!is_numeric($key)) {
|
||||
$object = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($object) {
|
||||
foreach($array as $k => $v) {
|
||||
$parts[] = "$k : " . $this->jsDeclaration($v);
|
||||
}
|
||||
return " {\n " . implode(", \n", $parts) . " }\n";
|
||||
} else {
|
||||
foreach($array as $part) $parts[] = $this->jsDeclaration($part);
|
||||
return " [ " . implode(", ", $parts) . " ]\n";
|
||||
}
|
||||
} else {
|
||||
return "'" . addslashes($array) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an array of classes in the CMS
|
||||
* which allows the user to change the page type.
|
||||
|
Loading…
x
Reference in New Issue
Block a user