/** * Process the template variable and return the output. * * {@inheritdoc} */ public function process($properties = null, $content = null) { parent::process($properties, $content); if (!$this->_processed) { $this->_content = $this->renderOutput($this->xpdo->resourceIdentifier); /* copy the content source to the output buffer */ $this->_output = $this->_content; if (is_string($this->_output) && !empty($this->_output)) { /* turn the processed properties into placeholders */ $scope = $this->xpdo->toPlaceholders($this->_properties, '', '.', true); /* collect element tags in the content and process them */ $maxIterations = intval($this->xpdo->getOption('parser_max_iterations', null, 10)); $this->xpdo->parser->processElementTags($this->_tag, $this->_output, $this->xpdo->parser->isProcessingUncacheable(), $this->xpdo->parser->isRemovingUnprocessed(), '[[', ']]', array(), $maxIterations); /* remove the placeholders set from the properties of this element and restore global values */ if (isset($scope['keys'])) { $this->xpdo->unsetPlaceholders($scope['keys']); } if (isset($scope['restore'])) { $this->xpdo->toPlaceholders($scope['restore']); } } /* apply output filtering */ $this->filterOutput(); /* cache the content */ $this->cache(); $this->_processed = true; } $this->xpdo->parser->setProcessingElement(false); /* finally, return the processed element content */ return $this->_output; }
/** * @param $keys */ public function unsetPlaceholders($keys) { $this->modx->unsetPlaceholders($keys); }