From 07051d09558d30c615b15aeadf649b8914234e1b Mon Sep 17 00:00:00 2001 From: Michael Richey Date: Sun, 3 Dec 2017 11:47:48 -0600 Subject: [PATCH] pretty print I've got pretty print much closer, but I haven't yet been able to produce it with a starting indent level. The alternative is to run the file xml output through the pretty printer before writing the file. --- admin/helpers/compiler/c_Fields.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 836b26762..08cbb4367 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -2334,7 +2334,11 @@ class Fields extends Structure { $dom = dom_import_simplexml($xml)->ownerDocument; $dom->formatOutput = true; - return $dom->saveXML($dom->getElementsByTagName($nodename)->item(0)); + $xmlString = $dom->saveXML($dom->getElementsByTagName($nodename)->item(0)); + $tidy = new Tidy(); + $tidy->parseString($xmlString,array('indent'=>true,'indent-spaces'=>8,'input-xml'=>true,'output-xml'=>true,'indent-attributes'=>true,'wrap-attributes'=>true,'wrap'=>false)); + $tidy->cleanRepair(); + return $tidy; } }