Skip to content

Commit

Permalink
MERGE: Merge branch '3.0' into 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kdambekalns committed Jun 15, 2017
2 parents 1f2748a + ced7ea7 commit 9240e8b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Classes/ViewHelpers/RenderViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,21 @@ class RenderViewHelper extends AbstractViewHelper
*/
public function initializeArguments()
{
$this->registerArgument('typoScriptFilePathPattern', 'string', 'Resource pattern to load Fusion from. Defaults to: resource://@package/Private/Fusion/', false);
$this->registerArgument('typoScriptFilePathPattern', 'string', 'Resource pattern to load Fusion from. Defaults to: resource://@package/Private/Fusion/. Deprecated, use fusionFilePathPattern instead.', false);
$this->registerArgument('fusionFilePathPattern', 'string', 'Resource pattern to load Fusion from. Defaults to: resource://@package/Private/Fusion/', false);
}

/**
* Evaluate the Fusion object at $path and return the rendered result.
*
* @param string $path Relative Fusion path to be rendered
* @param array $context Additional context variables to be set.
* @param string $typoScriptPackageKey The key of the package to load Fusion from, if not from the current context.
* @param string $typoScriptPackageKey The key of the package to load Fusion from, if not from the current context. Deprecated, use fusionFilePathPattern instead.
* @param string $fusionPackageKey The key of the package to load Fusion from, if not from the current context.
* @return string
* @throws \InvalidArgumentException
*/
public function render($path, array $context = null, $typoScriptPackageKey = null)
public function render($path, array $context = null, $typoScriptPackageKey = null, $fusionPackageKey = null)
{
if (strpos($path, '/') === 0 || strpos($path, '.') === 0) {
throw new \InvalidArgumentException('When calling the Fusion render view helper only relative paths are allowed.', 1368740480);
Expand All @@ -83,7 +85,7 @@ public function render($path, array $context = null, $typoScriptPackageKey = nul

$slashSeparatedPath = str_replace('.', '/', $path);

if ($typoScriptPackageKey === null) {
if ($typoScriptPackageKey === null && $fusionPackageKey === null) {
/** @var $fusionObject AbstractFusionObject */
$fusionObject = $this->viewHelperVariableContainer->getView()->getFusionObject();
if ($context !== null) {
Expand All @@ -102,7 +104,7 @@ public function render($path, array $context = null, $typoScriptPackageKey = nul
}
} else {
$this->initializeFusionView();
$this->fusionView->setPackageKey($typoScriptPackageKey);
$this->fusionView->setPackageKey($fusionPackageKey ?: $typoScriptPackageKey);
$this->fusionView->setFusionPath($slashSeparatedPath);
if ($context !== null) {
$this->fusionView->assignMultiple($context);
Expand All @@ -124,7 +126,9 @@ protected function initializeFusionView()
$this->fusionView = new FusionView();
$this->fusionView->setControllerContext($this->controllerContext);
$this->fusionView->disableFallbackView();
if ($this->hasArgument('typoScriptFilePathPattern')) {
if ($this->hasArgument('fusionFilePathPattern')) {
$this->fusionView->setFusionPathPattern($this->arguments['fusionFilePathPattern']);
} elseif ($this->hasArgument('typoScriptFilePathPattern')) {
$this->fusionView->setFusionPathPattern($this->arguments['typoScriptFilePathPattern']);
}
}
Expand Down

0 comments on commit 9240e8b

Please sign in to comment.