View class for render

@deprecated 3.4.0 Use setViewRenderer()/getViewRenderer() instead.
@param string|null $viewClass View class name.
@return string|$this
771490
public function viewRender($viewClass = null)
    {
        deprecationWarning('Email::viewRender() is deprecated. Use Email::setViewRenderer() or Email::getViewRenderer() instead.');

        if ($viewClass === null) {
            return $this->getViewRenderer();
        }
        $this->setViewRenderer($viewClass);

        return $this;
    }
840128
public function LoadView($viewname){
		$fn=BCOMPONENTSAPPLICATIONPATH.$this->componentname.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.$viewname.'.php';
		if(!file_exists($fn)){
			$fn=BCOMPONENTSFRAMEWORKPATH.$this->componentname.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.$viewname.'.php';
			}
		$class='View_'.$this->componentname.'_'.$viewname;
		if(!file_exists($fn)){
			return NULL;
			}
		require_once($fn);
		$view=new $class;
		$view->controller=$this;
		$view->componentname=$this->componentname;
		$view->templatename=$this->templatename;
		$view->viewname=$viewname;
		$view->init();
		return $view;
		}
525684
public function viewVars($viewVars = null)
    {
        deprecationWarning('Email::viewVars() is deprecated. Use Email::setViewVars() or Email::getViewVars() instead.');

        if ($viewVars === null) {
            return $this->getViewVars();
        }

        return $this->setViewVars($viewVars);
    }
187747
public function setModelClass($class)
    {
        $this->getTabs()->each(function (TabInterface $tab) use ($class) {
            if ($tab instanceof DisplayInterface) {
                $tab->setModelClass($class);
            }
        });

        return $this;
    }
1013373
public function render(View $view = null)
    {

        if ($this->rendered) {
            return true;
        }

        //$this->reloadResponseVars( $this->response );

        $onRender = new Event('Controller.beforeRender', $this);

        $this->observer->trigger($onRender);
        if ($onRender->isStopped()) {
            $this->autoRender = false;

            return $this->response;
        }

        //controllers only know about one view.
        //Every action uses a single view;
        //views can be set with $this->setView("") or $this->display(""); //or can be set on render;

        //If we are setting a really late view;
        $view = !is_null($view) ? $view : $this->getView();

        $this->response->addContent($view->render());

        $this->rendered = true;

        return true;
    }
414402
private function getBlockRendererForClass($blockClass)
    {
        if (!isset($this->renderers[$blockClass])) {
            return null;
        }

        return $this->renderers[$blockClass];
    }
64322
public function getView()
    {
        if (!empty($this->view)) {
            return $this->view;
        }

        $class = explode('\\', get_called_class());

        return 'merchant::form.'.strtolower(end($class));
    }
913037
public function selectRenderer(ViewEvent $e)
    {
        $model = $e->getModel();
        
        if ($model instanceof Model\PdfModel) {
            return $this->renderer;
        }

        return;
    }
324865
public function addClass($class) {
        $this->setVariable(self::VIEW_MODEL_CLASS, $this->addValue($this->getVariable(self::VIEW_MODEL_CLASS), $class));
    }
245302
final protected function beforeRenderView()
    {
        $this->initView();
        
        $view = $this->getView();
        
        $client = $this->clientType ? : static::input('clienttype');
        if ($client) {
            $configs = Config::get('views', $this->getModule()->getName(), true);
            if (isset($configs[$client]['theme'])) {
                $view->setTheme($configs[$client]['theme']);
            }
        }
        
        if (!$view->getBeginContent()) {
            $beginContent  = "<?php use Wslim\Ioc; ?>" . PHP_EOL;
            $view->setBeginContent($beginContent);
        }
        
        // ioc
        Ioc::$htmlHelper || Ioc::$htmlHelper = new HtmlHelper();
        Ioc::$formHelper || Ioc::$formHelper = new FormHelper();
        
        // view data
        $viewData = $view->getData();
        $viewData['rootUrl']  = Config::getRootUrl();
        $viewData['baseUrl']  = $this->getModule()->getBaseUrl(true);
        $viewData['lang']     = Ioc::language()->getData();
        $viewData['requestParams'] = $this->input();
        $viewData['page']     = $this->inputInt('page');
        
        return $this;
    }
21282
protected function makeModelDisplayValueFromModelClass($modelClass)
    {
        $stripPrefix = config('cms-models.collector.models-namespace');

        if ($stripPrefix && starts_with($modelClass, $stripPrefix)) {
            $modelClass = trim(substr($modelClass, 0, strlen($stripPrefix)), '\\');
        }

        return ucfirst(str_replace('\\', ' ', $modelClass));
    }
463992
protected function _engineRender($engines, $viewPath, $silence, $mustClean, $cache)
    {
        $basePath = $this->_basePath;
        $notExists = true;

        if (is_object($cache)) {
            $renderLevel = intval($this->_renderLevel);
            $cacheLevel = intval($this->_cacheLevel);
            if ($renderLevel >= $cacheLevel) {
                if ($cache->isStarted() === false) {
                    $viewOptions = $this->_options;
                    if (is_array($viewOptions)) {
                        if (isset($viewOptions['cache'])) {
                            $cacheOptions = $viewOptions['cache'];
                            if (is_array($cacheOptions)) {
                                if (isset($cacheOptions['key'])) {
                                    $key = $cacheOptions['key'];
                                }
                                if (isset($cacheOptions['lifetime'])) {
                                    $lifeTime = $cacheOptions['lifetime'];
                                }
                            }

                            if (!isset($key) || !$key) {
                                $key = md5($viewPath);
                            }

                            if (!isset($lifeTime)) {
                                $lifeTime = 0;
                            }

                            $cachedView = $cache->start($key, $lifeTime);
                            if (!$cachedView) {
                                $this->_content = $cachedView;
                                return null;
                            }
                        }

                        if (!$cache->isFresh()) {
                            return null;
                        }
                    }
                }
            }
        }
        $viewParams = $this->_viewParams;
        $eventsManager = $this->_eventsManager;

        foreach ($engines as $extension => $engine) {
            $viewEnginePath = $basePath . $this->resolveFullViewPath($viewPath) . $extension;

            if (file_exists($viewEnginePath)) {
                if (is_object($eventsManager)) {
                    $this->_activeRenderPath = $viewEnginePath;
                    if ($eventsManager->fire("view:beforeRenderView", $this, $viewEnginePath) === false) {
                        continue;
                    }
                }
                $engine->render($viewEnginePath, $viewParams, $mustClean);

                $notExists = false;
                if (is_object($eventsManager)) {
                    $eventsManager->fire("view:afterRenderView", $this);
                }
                break;
            }
        }
        if ($notExists) {
            if (is_object($eventsManager)) {
                $this->_activeRenderPath = $viewEnginePath;
                $eventsManager->fire("view:notFoundView", $this, $viewEnginePath);
            }

            if (!$silence) {
                throw new Exception(sprintf("View %s was not found in the views directory", $viewEnginePath));
            }
        }
    }
574314
protected function _actionRender(ViewContext $context)
    {
        $data = ObjectConfig::unbox($context->data);
        $path = $this->qualifyLayout($context->layout);

        //Render the template
        $content = $this->getTemplate()
            ->setParameters($context->parameters)
            ->render($path, $data);

        return $content;
    }
666345
protected function applyViewRenderer() {
		//set the ViewRenderer
		$config = $this->getConfig();
		$inputData = $this->getSite()->getSanitizedInputData();
		if ($viewRendererName = $this->getViewRendererName()) {
			$this->getSite()->setViewRenderer(new $viewRendererName($this->getSite()->getGlobalUser(),$this->getSite()->getPages(),$inputData,(!empty($config['controllerConfig']) ? $config['controllerConfig']['name']:null)));
		} else {
			$this->logger->error("ViewRenderer Class not found");
			exit;
		}
	}
56057
public function renderViewElement(View $view): ?string
    {
        if (empty($this->viewElement)) {
            return null;
        }

        return call_user_func_array([$view, 'element'], $this->viewElement);
    }
893464
public function getViewPath()
	{
		if($this->_viewPath===null)
		{
			$class=new ReflectionClass(get_class($this));
			$this->_viewPath=dirname($class->getFileName()).DIRECTORY_SEPARATOR.'views';
		}
		return $this->_viewPath;
	}
164429
public static function setViewContext($context = null)
    {
        if ($context === null) {
            $context = self::get(self::get('app.views.context_param', 'format'), 
                                self::get('app.views.default_context', 'html'), 
                                self::get('request'));
        }
        
        self::set('app.view_context', $context);
        
        if (($viewContextParams = self::get("app.views.contexts.$context", false)) !== false) {
            if ($viewContextParams['layout'] !== true) {
                self::set('app.layout', $viewContextParams['layout']);
            }
            header('Content-type: ' . 
                self::get('content_type', 'text/html', $viewContextParams));
        }
    }