Example #1
0
 /**
  * Init the view with some options
  * called from the layout
  *
  * @param array $config
  */
 public function __construct($config)
 {
     if (is_string($config) && preg_match('/\\//', $config)) {
         $this->setPath($config);
     } else {
         if (is_array($config) && array_key_exists('view', $config) && array_key_exists('action', $config)) {
             // Set components by default layout
             $this->setAction($config['action']);
             $this->setName($config['view']);
             $this->setPath($config['view']);
             $this->setViewControllerClass();
         } else {
             if (true == $config instanceof \Fewlines\Core\Http\Router\Routes\Route) {
                 $this->activeRoute = $config;
                 $this->setRouteControllerClass($this->activeRoute->getToClass());
             }
         }
     }
 }