* @package Vhs * @subpackage ViewHelpers\Render */ class InlineViewHelper extends AbstractRenderViewHelper { /** * Initialize arguments * * @return void */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('namespaces', 'array', 'Optional additional/overridden namespaces, array("ns" => "Tx_MyExt_ViewHelpers")', FALSE, array()); } /** * Renders an outside string as if it were Fluid code, * using additional (or overridden) namespaces if so * desired. * * @param string $content * @return string */ public function render($content = NULL) { if (NULL === $content) { $content = $this->renderChildren(); } $namespaces = $this->getPreparedNamespaces(); $namespaceHeader = implode(LF, $namespaces); foreach ($namespaces as $namespace) { $content = str_replace($namespace, '', $content); } $view = $this->getPreparedClonedView(); $view->setTemplateSource($namespaceHeader . $content); return $this->renderView($view); } }