FOF30\Factory\SwitchFactory::view PHP Method

view() public method

Create a new View object
public view ( string $viewName, string $viewType = 'html', array $config = [] ) : View
$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 FOF30\View\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);
        }
    }

Usage Example

Esempio n. 1
0
 /**
  * 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);
     }
 }
All Usage Examples Of FOF30\Factory\SwitchFactory::view