Skip to content

Commit

Permalink
Preferred - Default view
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Nov 8, 2021
1 parent c6cad29 commit 2c7c690
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ViewModel implements Model, ContextAware
{
protected string $_preferredView;
protected string $_defaultView;

use ContextAwareTrait;
use WithContextTrait;
Expand All @@ -19,17 +19,17 @@ public function jsonSerialize()
return empty($values) ? $this : $values;
}

public function setPreferredView(string $viewClass)
public function setDefaultView(string $viewClass)
{
$this->_preferredView = $viewClass;
$this->_defaultView = $viewClass;
return $this;
}

public function createView(string $viewClass = null)
{
if($viewClass === null && !empty($this->_preferredView))
if($viewClass === null && !empty($this->_defaultView))
{
$viewClass = $this->_preferredView;
$viewClass = $this->_defaultView;
}

if($viewClass === '' || !class_exists($viewClass))
Expand Down

0 comments on commit 2c7c690

Please sign in to comment.