@param BaseView $view
@param $blockName

@return mixed
504100
public function getResourceForBlockName(BaseView $view, string $blockName)
    {
        $cacheKey = $view->vars[self::CACHE_KEY_VAR];

        if (!isset($this->resources[$cacheKey][$blockName])) {
            $this->loadResourceForBlockName($cacheKey, $view, $blockName);
        }

        return $this->resources[$cacheKey][$blockName];
    }
805951
public function getViewProviders(View $view)
    {
        foreach (array_keys($this->viewProviders) as $type) {
            if ($view instanceof $type) {
                return $this->viewProviders[$type];
            }
        }
        throw new InvalidArgumentException('view', 'No compatible ViewProvider found for ' . gettype($view));
    }
17178
public function getBlockURL($filename = null)
    {
        $obj = $this->blockType;
        if ($obj->getPackageID() > 0) {
            if (is_dir(DIR_PACKAGES_CORE . '/' . $obj->getPackageHandle())) {
                $base = ASSETS_URL . '/' . DIRNAME_PACKAGES . '/' . $obj->getPackageHandle(
                    ) . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
            } else {
                $base = DIR_REL . '/' . DIRNAME_PACKAGES . '/' . $obj->getPackageHandle(
                    ) . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
            }
        } else {
            if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . $filename)) {
                $base = REL_DIR_APPLICATION . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
            } else {
                $base = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
            }
        }

        return $base;
    }
107537
public static function getView($viewName, $data = null, $templateRootFolder = null)
    {
        $view = new \erdiko\core\View($viewName, $data);

        if ($templateRootFolder !== null) {
            $view->setTemplateRootFolder($templateRootFolder);
        }
        return  $view->toHtml();
    }
26840
public function display($view = 'view')
    {
        if ($this->getBlockTypeID() < 1) {
            return;
        }

        $bv = new BlockView($this);
        $bv->render($view);
    }
656655
protected function endRenderBlock($blockName)
    {
        $contents = ob_get_contents();
        ob_end_clean();
        foreach ($this->plugins as $plugin) {
            $blockRenderList = $plugin->getBlockRenderList();
            if (in_array($blockName, $blockRenderList) === true) {
                echo $plugin->callBlockRenderEnd($blockName, $contents);
                return;
            }
        }
        echo $contents;
        throw new JigException("Block $blockName not known for ending block in plugins.");
    }
645445
public function renderPager(TableView $view, $viewName = 'twitter_bootstrap3', array $options = [])
    {
        if (!$view->pager) {
            return '';
        }

        $pageParam = $view->ui['page_name'];

        $options = array_merge([
            'pageParameter' => '[' . $pageParam . ']',
            'proximity'     => 3,
            'next_message'  => '&raquo;',
            'prev_message'  => '&laquo;',
            'default_view'  => 'default',
        ], $options);

        $routeGenerator = function ($page) use ($pageParam) {
            return '?' . $pageParam . '=' . $page;
        };

        return $this->viewFactory->get($viewName)->render($view->pager, $routeGenerator, $options);
    }
1050763
public function resolve($template, $view = null)
    {
        if (!$template) {
            return '';
        }

        $segments = explode('/', $template);
        $page = end($segments);

        foreach ($this->baseDirectories as $dirs) {
            foreach ($dirs as $dir) {
                if ($t = $this->tryTemplate($dir, $template, $view)) {
                    return $t;
                }

                if ($t = $this->tryTemplate($dir, $template.$this->extension, $view)) {
                    return $t;
                }
            }
        }

        if ($template[0] !== '_') {

            foreach ($this->baseDirectories as $dirs) {
                foreach ($dirs as $dir) {
                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page, $view)) {
                        return $t;
                    }

                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page.$this->extension, $view)) {
                        return $t;
                    }
                }
            }

        }

    }
1351412
public function build(HtmlView $view, array $attrs = null, array $ulAttrs = null, array $liAttrs = null, array $aAttrs = null) {
		$pageState = $view->lookup(PageState::class);
		CastUtils::assertTrue($pageState instanceof PageState);
		
		$navItemBuilder = null;
		if ($this->navItemBuilder === null) {
			$navItemBuilder = new CommonNavItemBuilder();
		} else if ($this->navItemBuilder instanceof NavItemBuilder) {
			$navItemBuilder = $this->navItemBuilder;
		} else {
			$navItemBuilder = $view->lookup($this->navItemBuilder);
			if (!($navItemBuilder instanceof NavItemBuilder)) {
				throw new UiException('Invalid NavItemBuilder: ' . $navItemBuilder);
			}
		}
		
		$navFactory = new NavFactory($navItemBuilder, $view->getN2nLocale(), $this->numLevels, $this->numOpenLevels);
		if ($pageState->hasCurrent()) {
			$navFactory->setCurrentNavBranch($pageState->getCurrentNavBranch());
		}
		$navFactory->setNumLevels($this->numLevels);
		$navFactory->setNumOpenLevels($this->numOpenLevels);
		$navFactory->setRootUlAttrs((array) $attrs);
		$navFactory->setUlAttrs((array) $ulAttrs);
		$navFactory->setLiAttrs((array) $liAttrs);
		$navFactory->setAAttrs((array) $aAttrs);
		
		$n2nLocale = $view->getN2nLocale();
		$navBranch = $this->navBranchCriteria->determine($pageState, $n2nLocale, $view->getN2nContext());
		$startLevel = 1;
		if ($this->absStartlevelNo !== null) {
			$startLevel = $this->absStartlevelNo - $navBranch->getLevel();
		} else if ($this->relStartLevelNo !== null) {
			$startLevel = $this->relStartLevelNo;
		}
		
		return $navFactory->create($view, $this->dertermineBases($navBranch, $startLevel));
	}
261446
public function getView(View $view)
    {
        if (!$view instanceof BlockValueView) {
            return null;
        }

        $block = $view->getBlock();

        $legacyKernel = $this->getLegacyKernel();
        $legacyBlockClosure = static function (array $params) use ($block, $legacyKernel) {
            return $legacyKernel->runCallback(
                static function () use ($block, $params) {
                    $tpl = eZTemplate::factory();
                    /**
                     * @var \eZObjectForwarder
                     */
                    $funcObject = $tpl->fetchFunctionObject('block_view_gui');
                    if (!$funcObject) {
                        return '';
                    }

                    $children = [];
                    $funcObject->process(
                        $tpl, $children, 'block_view_gui', false,
                        [
                            'block' => [
                                [
                                    eZTemplate::TYPE_ARRAY,
                                    // eZTemplate::TYPE_OBJECT does not exist because
                                    // it's not possible to create "inline" objects in
                                    // legacy template engine (ie objects are always
                                    // stored in a tpl variable).
                                    // TYPE_ARRAY is used here to allow to directly
                                    // retrieve the object without creating a variable.
                                    // (TYPE_STRING, TYPE_BOOLEAN, ... have the same
                                    // behaviour, see eZTemplate::elementValue())
                                    new BlockAdapter($block),
                                ],
                            ],
                        ],
                        [], '', ''
                    );
                    if (\is_array($children) && isset($children[0])) {
                        return ezpEvent::getInstance()->filter('response/output', $children[0]);
                    }

                    return '';
                },
                false
            );
        };

        return new ContentView($legacyBlockClosure);
    }
169986
public function renderView($view, array $locals = [])
    {
        $content = View::render($view, $locals);

        if (isset($locals['_layout']) && $locals['_layout']) {
            $content = $this->renderView("layouts/{$locals['_layout']}", [
                'content' => $content
            ]);
        }

        return $content;
    }
902634
public static function isType(BlockView $view, $type)
    {
        return isset($view->vars['block_prefixes'])
            && \is_array($view->vars['block_prefixes'])
            && \in_array($type, $view->vars['block_prefixes']);
    }
902796
public function blockJson($blockName, $options = [])
    {
        if (array_key_exists('returnAll', $options) && $options['returnAll']) {
            unset($options['returnAll']);
            $blocksData = [];
            $themeId = ($theme = Theme::where('theme', '=', $this->theme)->first()) ? $theme->id : 0;
            $template = Template::preload($this->template);
            $categoryBlocks = ThemeTemplate::templateBlocks($themeId, $template->exists ? $template->id : null);
            foreach ($categoryBlocks as $blockCategory => $blocks) {
                foreach ($blocks as $block) {
                    $blocksData += json_decode($this->blockJson($block->name, $options), true);
                }
            }
            return collect($blocksData)->toJson();
        }
        return $this->_block($blockName, $options, 'toJson');
    }
768329
protected function buildBlockView($id, BlockView $parentView = null)
    {
        $blockType       = $this->rawLayout->getProperty($id, RawLayout::BLOCK_TYPE, true);
        $resolvedOptions = $this->rawLayout->getProperty($id, RawLayout::RESOLVED_OPTIONS, true);
        $types           = $this->typeHelper->getTypes($blockType);
        $view            = new BlockView($parentView);

        if (is_null($resolvedOptions)) { // Try to resolve options again to render block
            $options  = $this->rawLayout->getProperty($id, RawLayout::OPTIONS, true);
            $resolvedOptions = $this->setBlockResolvedOptions($id, $blockType, $options, $types);
        }

        // point the block view state to the current block
        $this->block->initialize($id);
        // build the view
        foreach ($types as $type) {
            $type->buildView($view, $this->block, $resolvedOptions);
            $this->registry->buildView($type->getName(), $view, $this->block, $resolvedOptions);
        }

        array_walk_recursive(
            $view->vars,
            function (&$var) {
                if ($var instanceof Options) {
                    $var = $var->toArray();
                }
            }
        );

        return $view;
    }
337972
public function getView(View $view)
    {
        if (($configHash = $this->matcherFactory->match($view)) === null) {
            return null;
        }

        // We can set the collection directly to the view, no need to go through DTO
        $view->addParameters([
            ContentView::QUERY_DEFINITION_COLLECTION_NAME => $this->getQueryDefinitionCollection($configHash, $view),
        ]);

        // Return DTO so that Configurator can set the data back to the $view
        return $this->getDTO($configHash);
    }
982708
public static function getParentFormView(BlockView $view)
    {
        if (isset($view->vars['block_form']) && null !== $view->vars['block_form']) {
            return $view->vars['block_form'];
        }

        return null !== $view->parent
            ? static::getParentFormView($view->parent)
            : null;
    }
326850
public function setView($view)
    {

        if (class_exists($view)) {
            //if we already have a default view
            $values = [];

            //grab all its parameters and store in parameters
            if (isset($this->view) && $this->view instanceof View) {

                $values = $this->view->getDataArray();
                $layout = $this->view->getLayout();

                //Load the newView;
                $this->view = $this->loadView($view, $values);

                if (!empty($layout)) {
                    $this->view->setLayout($layout);
                }
            }

            return $this;

        } else if (is_string($view)) {

            $this->response->addContent($view); //so that $this->view("Hi There");  will output Hi There;

            return $this;

        }

        return false; //no view set;
    }