Renders the parent block widget defined in other resources on all levels of block prefix hierarchy

@param BlockView $view
@param array $variables

@return string
501376
public function parentBlockWidget(BlockView $view, array $variables = [])
    {
        return $this->renderer->searchAndRenderBlock($view, 'widget', $variables, true);
    }
608125
private function renderPlaceholderRecursive($navItemPageId, $placeholderVar, $prevId, $layoutBlockInstance = null)
    {
        $string = '';
        $i = 0;
        $equalIndex = 1;
        $placeholders = $this->getPlaceholders($navItemPageId, $placeholderVar, $prevId);
        $blocksCount = count($placeholders);
        $variations = Yii::$app->getModule('cmsadmin')->blockVariations;
        
        // foreach all placeholders but preserve varaibles above to make calculations
        foreach ($placeholders as $key => $placeholder) {
            $i++;
            $prev = $key-1;
            $next = $key+1;
            $cacheKey = ['blockcache', (int) $placeholder['id']];

            $blockResponse = $this->getHasCache($cacheKey);
    
            /** @var $blockObject \luya\cms\base\InternalBaseBlock */
            //$blockObject = Block::objectId($placeholder['block_id'], $placeholder['id'], 'frontend', $this->getNavItem());
            $blockObject = Block::createObject($placeholder['class'], $placeholder['block_id'], $placeholder['id'], 'frontend', $this->getNavItem());
    
            if ($blockObject) {
                if ($blockResponse === false) {
                    $className = get_class($blockObject);
                    // insert var and cfg values from database
                    $blockObject->setVarValues($this->jsonToArray($placeholder['json_config_values']));
                    $blockObject->setCfgValues($this->jsonToArray($placeholder['json_config_cfg_values']));
        
                    // inject variations variables
                    $possibleVariations = isset($variations[$className]) ? $variations[$className] : false;
                    $ensuredVariation = false;

                    if ($possibleVariations && isset($possibleVariations[$placeholder['variation']])) {
                        $ensuredVariation = $possibleVariations[$placeholder['variation']];
                    } elseif ($possibleVariations) {
                        foreach ($possibleVariations as $name => $content) {
                            if ($content['is_default']) {
                                $ensuredVariation = $content;
                            }
                        }
                    }
                    if ($ensuredVariation) {
                        // otherwise foreach the configuration variation and assign.
                        foreach ($ensuredVariation as $type => $typeContent) {
                            if (!empty($typeContent)) {
                                $type = strtolower($type);
                                switch ($type) {
                                    case "vars": $blockObject->setVarValues($typeContent); break;
                                    case "cfgs": $blockObject->setCfgValues($typeContent); break;
                                    case "extras":
                                        foreach ($typeContent as $extraKey => $extraValue) {
                                            $blockObject->addExtraVar($extraKey, $extraValue);
                                        }
                                        break;
                                }
                            }
                        }
                    }
                    // set env options from current object environment
                    foreach ($this->getOptions() as $optKey => $optValue) {
                        $blockObject->setEnvOption($optKey, $optValue);
                    }
        
                    $blockObject->setEnvOption('index', $i);
                    $blockObject->setEnvOption('itemsCount', $blocksCount);
                    $blockObject->setEnvOption('isFirst', ($i == 1));
                    $blockObject->setEnvOption('isLast', ($i == $blocksCount));
                    $prevIsEqual = array_key_exists($prev, $placeholders) && $placeholder['block_id'] == $placeholders[$prev]['block_id'];
                    $blockObject->setEnvOption('isPrevEqual', $prevIsEqual);
                    $blockObject->setEnvOption('isNextEqual', array_key_exists($next, $placeholders) && $placeholder['block_id'] == $placeholders[$next]['block_id']);
        
                    if (!$prevIsEqual) {
                        $equalIndex = 1;
                    } else {
                        $equalIndex++;
                    }
                    $blockObject->setEnvOption('equalIndex', $equalIndex);
        
                    // render sub placeholders and set into object
                    $insertedHolders = [];
                    foreach ($blockObject->getConfigPlaceholdersExport() as $item) {
                        $insertedHolders[$item['var']] = $this->renderPlaceholderRecursive($navItemPageId, $item['var'], $placeholder['id'], $blockObject);
                    }
                    $blockObject->setPlaceholderValues($insertedHolders);
                    // output buffer the rendered frontend method of the block
                    if ($layoutBlockInstance) {
                        $blockResponse = $layoutBlockInstance->placeholderRenderIteration($blockObject);
                    } else {
                        $blockResponse = $blockObject->renderFrontend();
                    }
                    
        
                    if ($blockObject->getIsCacheEnabled()) {
                        $this->setHasCache($cacheKey, $blockResponse, null, $blockObject->getCacheExpirationTime());
                        $blockObject->onRegister();
                    }
                } else {
                    $blockObject->onRegisterFromCache();
                }
            }
    
            $string.= $blockResponse;
            
            unset($blockResponse);
        }

        unset($variations);
        unset($placeholders);
        
        return $string;
    }
983131
private function renderParentBlock(Template $parent, $blockName, Context $context)
    {
        while ($parent->parentTemplate) {
            $parent = $this->environment->load($parent->parentTemplate);
            if (isset($parent->blocks[ $blockName ])) {
                $parent->blocks[$blockName]($context);

                return;
            }
        }

        throw new \RuntimeException("Block {$blockName} was not found.");
    }
1181583
private function render(string $view, array $options = []): string
    {
        extract($options, EXTR_OVERWRITE);

        ob_start();
        require $this->getFilename($view);

        return ob_get_clean();
    }
256708
public function render($view = null, $data = array())
    {
        if (is_null($view)) {
            $view = static::$defaultSimpleView;
        }

        $data = array_merge($data, array(
            'paginator' => $this,
        ));

        return new HtmlString(
            static::viewFactory()->make($view, $data)->render()
        );
    }
455429
public function render( $view, array $data = [] ) {
		if ( in_array( $view, $this->extensions ) ) {
			return '';
		}

		try {
			return $this->instance()->render( $view, $data );
		} catch ( Twig_Error $e ) {
			do_action( 'digster/twig_render_exception', $e );
			$this->render_error( $e );
		}
	}
73653
public function index(PageController $parent_controller, Tree $tree, $block_id, $template) {        
        $view_bag = new ViewBag();
        
        if($parent_controller && $tree) {
        
            $view_bag->set('tree', $tree);
            $view_bag->set('indi', $parent_controller->getSignificantIndividual());
        
            $id = $this->module->getName().$block_id;
            $class = $this->module->getName().'_block';
            $parent_controller->addInlineJavascript('
                jQuery("#maj-new_passwd").hide();
                jQuery("#maj-passwd_click").click(function()
                {
                    jQuery("#maj-new_passwd").slideToggle(100, function() {
                        jQuery("#maj-new_passwd_username").focus();
    			});
    					return false;
    				  });
    			');
    
            if (Auth::isAdmin()) {
                $title='<a class="icon-admin" title="'.I18N::translate('Preferences').'" href="block_edit.php?block_id='.$block_id.'&amp;ged=' . $tree->getNameHtml() . '&amp;ctype=gedcom"></a>';
            } else {
                $title='';
            }
            $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>';
    
            $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false);
            $view_bag->set('piwik_enabled', $piwik_enabled);
            if($piwik_enabled) {
                $parent_controller->addInlineJavascript(
                    '$("#piwik_stats")
                        .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");'
                );
            }
    
            $content = ViewFactory::make('WelcomeBlock', $this,  new BaseController(), $view_bag)->getHtmlPartial();   
            
            if ($template) {
                return Theme::theme()->formatBlock($id, $title, $class, $content);
            } else {
                return $content;
            }
        }
    }
930729
public function render($template, array $localVariables = array())
    {
        $view = $this->getView();

        if ($view->getLayout()) {
            $content = $view->renderWithLayout($template, $localVariables);
        } else {
            $content = $view->render($template, $localVariables);
        }

        $this->getResponse()->setBody($content);

        return $this;
    }
1362216
public function renderPartial($partialName, $sectionName, array $variables)
    {
        if (!isset($this->partialIdentifierCache[$partialName])) {
            $this->partialIdentifierCache[$partialName] = $this->getPartialIdentifier($partialName);
        }
        $partialIdentifier = $this->partialIdentifierCache[$partialName];

        if ($this->templateCompiler->has($partialIdentifier)) {
            $parsedPartial = $this->templateCompiler->get($partialIdentifier);
        } else {
            $this->templateParser->setConfiguration($this->buildParserConfiguration());
            $parsedPartial = $this->templateParser->parse($this->getPartialSource($partialName));
            if ($parsedPartial->isCompilable()) {
                $this->templateCompiler->store($partialIdentifier, $parsedPartial);
            }
        }

        /** @var $variableContainer TemplateVariableContainer **/
        $variableContainer = $this->objectManager->get(\TYPO3\Fluid\Core\ViewHelper\TemplateVariableContainer::class, $variables);
        $renderingContext = clone $this->getCurrentRenderingContext();
        $renderingContext->injectTemplateVariableContainer($variableContainer);

        $this->startRendering(self::RENDERING_PARTIAL, $parsedPartial, $renderingContext);
        if ($sectionName !== null) {
            $output = $this->renderSection($sectionName, $variables);
        } else {
            $output = $parsedPartial->render($renderingContext);
        }
        $this->stopRendering();

        return $output;
    }
900576
public function render($view, array $vars = [])
    {
        if ($vars) {
            $this->vars = array_merge($this->vars, $vars);
        }

        $output = $this->includeView($view, $this->vars, $return_content = true);

        while ($this->block_stack) {
            $this->endBlock();
        }

        if (!$extend_view = $this->extend_view) {
            return $output;
        }

        $this->extend_view = null;

        return $this->render($extend_view);
    }
942748
public function label(FormView $view, $label = null, array $variables = [])
    {
        if (null !== $label) {
            $variables += ['label' => $label];
        }

        return $this->renderer->searchAndRenderBlock($view, 'label', $variables);
    }
502311
protected function getTranslationDomain(BlockView $view)
    {
        $translationDomain = $view->vars['translation_domain'];
        if (!$translationDomain && $view->parent) {
            $translationDomain = $view->parent->vars['translation_domain'];
        }
        if (!$translationDomain) {
            $translationDomain = 'messages';
        }

        return $translationDomain;
    }
73427
protected function view($view, $data = [])
    {
        return parent::view($view, $data)
            ->with('resource', $this->resource)
            ->with('navigation', $this->navigation)
            ->with('pagecrumbItems', $this->pagecrumbItems)
            ->with('breadcrumbItems', $this->breadcrumbItems)
            ->with('selectedNavigation', $this->selectedNavigation)
            ->with('selectedNavigationParents', $this->urlParentNavs);
    }
413660
protected function replaceVariablesInTemplate(string $template, array $variables) : string
    {
        $template = preg_replace_callback(
            '/\{\{\s*' . self::REGEX_VARIABLE . '\s*\}\}/i',
            function (array $matches) use ($variables): string {
                return (string) $this->getValue($matches, $variables);
            },
            $template
        );

        return $template;
    }
1094859
public function render(\Zend_View_Interface $view = null)
    {
        if ($this->_getIsRendered()) {
            return;
        }

        $this->fixDecorators();

        return parent::render($view);
    }
1029440
private function renderBlock(array $blockNames, $cacheKey, array $context)
    {
        $template = $blockName = null;

        $themes = $this->defaultThemes;
        if (isset($this->themes[$cacheKey])) {
            $themes = array_merge($this->themes[$cacheKey], $this->defaultThemes);
        }

        // Search the template for first block available
        foreach ($blockNames as $name) {
            if ($template = $this->getTemplateForBlock($name, $themes)) {
                $blockName = $name;
                break;
            }
        }

        // Throw if no matching blocks are found
        if (empty($template)) {
            throw new \RuntimeException(sprintf(
                "Block%s %s not found in table themes (%s)",
                count($blockNames) > 1 ? 's' : '', implode(', ', $blockNames), implode(', ', $this->defaultThemes)
            ));
        }

        return $template->renderBlock($blockName, $context);
    }
681522
public function render($view = null)
    {
        if (is_null($view) and ! isset($this->templatePaths[$this->defaultLanguage])) {
            return '';
        }
        $return   = (is_null($view)) ? view($this->templatePaths[$this->defaultLanguage], $this->predefinedVariables) : view($view, $this->predefinedVariables);
        $adapter  = app(VariablesAdapter::class);
        $rendered = $adapter->fill($return->__toString());
        preg_match_all('/\[\[(.*?)\]\]/', $rendered, $matches);
        if (isset($matches[0]) && isset($matches[1])) {
            foreach ($matches[0] as $index => $variable) {
                $rendered = str_replace($variable, '{{ ' . $matches[1][$index] . ' }}', $rendered);
            }
            $twig = new Twig_Environment(new Twig_Loader_String());
            return $twig->render($rendered, $this->predefinedVariables);
        }

        return $rendered;
    }