mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #5658 from kinglozzer/5656-up-top
FIX: Regression with <% with $Up/$Top %> (fixes #5656)
This commit is contained in:
commit
f9ad2e2bbe
@ -0,0 +1 @@
|
||||
$Title<% with $Item %> - <% with $Up %>$Title<% end_with %> - <% with $NestedItem %><% with $Top %>$Title<% end_with %><% end_with %><% end_with %>
|
@ -726,6 +726,16 @@ after')
|
||||
'A - B - C - B - A'
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
$this->render('<% include SSViewerTestIncludeScopeInheritanceWithUpAndTop Title="A" %>',
|
||||
new ArrayData(array(
|
||||
'Item' => new ArrayData(array(
|
||||
'Title' =>'B', 'NestedItem' => new ArrayData(array('Title' => 'C'))
|
||||
)))
|
||||
)),
|
||||
'A - A - A'
|
||||
);
|
||||
|
||||
$data = new ArrayData(array(
|
||||
'Nested' => new ArrayData(array(
|
||||
'Object' => new ArrayData(array('Key' => 'A'))
|
||||
|
@ -558,12 +558,15 @@ class SSViewer_DataPresenter extends SSViewer_Scope {
|
||||
*/
|
||||
public function pushScope() {
|
||||
$scope = parent::pushScope();
|
||||
$upIndex = $this->getUpIndex();
|
||||
|
||||
$itemStack = $this->getItemStack();
|
||||
$itemStack[$this->getUpIndex()][SSViewer_Scope::ITEM_OVERLAY] = $this->overlay;
|
||||
if ($upIndex !== null) {
|
||||
$itemStack = $this->getItemStack();
|
||||
$itemStack[$upIndex][SSViewer_Scope::ITEM_OVERLAY] = $this->overlay;
|
||||
|
||||
$this->setItemStack($itemStack);
|
||||
$this->overlay = array();
|
||||
$this->setItemStack($itemStack);
|
||||
$this->overlay = array();
|
||||
}
|
||||
|
||||
return $scope;
|
||||
}
|
||||
@ -575,8 +578,12 @@ class SSViewer_DataPresenter extends SSViewer_Scope {
|
||||
* @return SSViewer_Scope
|
||||
*/
|
||||
public function popScope() {
|
||||
$itemStack = $this->getItemStack();
|
||||
$this->overlay = $itemStack[$this->getUpIndex()][SSViewer_Scope::ITEM_OVERLAY];
|
||||
$upIndex = $this->getUpIndex();
|
||||
|
||||
if ($upIndex !== null) {
|
||||
$itemStack = $this->getItemStack();
|
||||
$this->overlay = $itemStack[$this->getUpIndex()][SSViewer_Scope::ITEM_OVERLAY];
|
||||
}
|
||||
|
||||
return parent::popScope();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user