Skip to content

Commit

Permalink
Fix views hierarchy handling for toolbar. Fixes #3327
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsn committed Jul 17, 2020
1 parent 14a6bd9 commit f6a4d52
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion system/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,29 @@ public function render(string $view, array $options = null, bool $saveData = nul
$this->data = $this->tempData;
}

// Save current vars
$renderVars = $this->renderVars;

ob_start();
include($this->renderVars['file']); // PHP will be processed
$output = ob_get_contents();
@ob_end_clean();

// Get back current vars
$this->renderVars = $renderVars;

// When using layouts, the data has already been stored
// in $this->sections, and no other valid output
// is allowed in $output so we'll overwrite it.
if (! is_null($this->layout) && empty($this->currentSection))
{
$layoutView = $this->layout;
$this->layout = null;
$output = $this->render($layoutView, $options, $saveData);
// Save current vars
$renderVars = $this->renderVars;
$output = $this->render($layoutView, $options, $saveData);
// Get back current vars
$this->renderVars = $renderVars;
}

$this->logPerformance($this->renderVars['start'], microtime(true), $this->renderVars['view']);
Expand Down

0 comments on commit f6a4d52

Please sign in to comment.