mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Add a self method to the SSViewer scope.
This returns the current object, and resets the scope.
This commit is contained in:
parent
14a56c18e9
commit
a4096ecc70
@ -97,6 +97,18 @@ class SSViewer_Scope {
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current object and resets the scope.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public function self() {
|
||||||
|
$result = $this->itemIterator ? $this->itemIterator->current() : $this->item;
|
||||||
|
$this->resetLocalScope();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
public function pushScope(){
|
public function pushScope(){
|
||||||
$newLocalIndex = count($this->itemStack)-1;
|
$newLocalIndex = count($this->itemStack)-1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user