Create a new View object
public view ( string $viewName, string $viewType = 'html', array $config = [] ) : |
||
$viewName | string | The name of the view we're getting a View object for. |
$viewType | string | The type of the View object. By default it's "html". |
$config | array | Optional MVC configuration values for the View object. |
return |
/** * Create a new View object * * @param string $viewName The name of the view we're getting a View object for. * @param string $viewType The type of the View object. By default it's "html". * @param array $config Optional MVC configuration values for the View object. * * @return View */ public function view($viewName, $viewType = 'html', array $config = array()) { try { return parent::view($viewName, $viewType, $config); } catch (ViewNotFound $e) { $magic = new Magic\ViewFactory($this->container); return $magic->make($viewName, $viewType, $config); } }
/** * Create a new View object * * @param string $viewName The name of the view we're getting a View object for. * @param string $viewType The type of the View object. By default it's "html". * @param array $config Optional MVC configuration values for the View object. * * @return View */ public function view($viewName, $viewType = 'html', array $config = array()) { try { return parent::view($viewName, $viewType, $config); } catch (ViewNotFound $e) { } $viewClass = $this->container->getNamespacePrefix('inverse') . 'View\\' . ucfirst($viewName) . '\\' . ucfirst($viewType); try { return $this->createView($viewClass, $config); } catch (ViewNotFound $e) { $viewClass = $this->container->getNamespacePrefix('inverse') . 'View\\' . ucfirst($this->container->inflector->singularize($viewName)) . '\\' . ucfirst($viewType); return $this->createView($viewClass, $config); } }