Skip to content

Commit

Permalink
Show param pool in page XML (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdunn committed Oct 29, 2010
1 parent b224cca commit e2e450c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions symphony/lib/toolkit/class.frontendpage.php
Expand Up @@ -272,6 +272,29 @@ private function __buildPage(){
<xsl:import href="./workspace/pages/' . basename($page['filelocation']).'"/>
</xsl:stylesheet>';

$params = new XMLElement('params');
foreach($this->_param as $key => $value) {
$param = new XMLElement($key);

// DS output params get flattened to a string, so get the original pre-flattened array
if (isset($this->_env['pool'][$key])) $value = $this->_env['pool'][$key];

if (is_array($value)) {
foreach ($value as $key => $value) {
$item = new XMLElement('item', General::sanitize($value));
$item->setAttribute('handle', Lang::createHandle($value));
$param->appendChild($item);
}
}
else {
$param->setValue(General::sanitize($value));
}

$params->appendChild($param);

}
$xml->prependChild($params);

$this->_Parent->Profiler->seed();
$this->setXML($xml->generate(true, 0));
$this->_Parent->Profiler->sample('XML Generation', PROFILE_LAP);
Expand Down

0 comments on commit e2e450c

Please sign in to comment.