| 1 | <?php |
||
| 11 | class CurrentViewHelper |
||
| 12 | { |
||
| 13 | protected $currentView; |
||
| 14 | protected $updatedCurrentView; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Get currentView. |
||
| 18 | * |
||
| 19 | * @return View |
||
| 20 | */ |
||
| 21 | public function getCurrentView() |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Get updatedCurrentView. |
||
| 28 | * |
||
| 29 | * @return View |
||
| 30 | */ |
||
| 31 | public function getUpdatedCurrentView() |
||
| 32 | { |
||
| 33 | return $this->updatedCurrentView; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Set currentView. |
||
| 38 | * |
||
| 39 | * @param View $currentView |
||
| 40 | * |
||
| 41 | * @return $this |
||
| 42 | */ |
||
| 43 | public function setCurrentView(View $currentView) |
||
| 44 | { |
||
| 45 | if ($this->currentView == null) { |
||
| 46 | $this->currentView = clone $currentView; |
||
| 47 | } |
||
| 48 | $this->updatedCurrentView = $currentView; |
||
| 49 | |||
| 50 | return $this; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * This method allow you to get the current view using a Current View Helper as a method |
||
| 55 | * ex. |
||
| 56 | * $currentViewHelper = $this->get('victoire_core.current_view'); |
||
| 57 | * $currentView = $currentViewHelper();. |
||
| 58 | * |
||
| 59 | * @return View The current View |
||
| 60 | */ |
||
| 61 | public function __invoke() |
||
| 67 | } |
||
| 68 |