public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
    {
        /** @var FieldViewHelperService $fieldService */
        $fieldService = Core::instantiate(FieldViewHelperService::class);

        if (false === $fieldService->fieldContextExists()) {
            throw ContextNotFoundException::slotRenderViewHelperFieldContextNotFound();
        }

        /** @var SlotViewHelperService $slotService */
        $slotService = Core::instantiate(SlotViewHelperService::class);
        $slotName = $arguments['slot'];
        $result = '';

        if ($slotService->hasSlot($slotName)) {
            $currentVariables = version_compare(VersionNumberUtility::getCurrentTypo3Version(), '8.0.0', '<')
                ? $renderingContext->getTemplateVariableContainer()->getAll()
                : $renderingContext->getVariableProvider()->getAll();

            ArrayUtility::mergeRecursiveWithOverrule($currentVariables, $arguments['arguments']);

            $slotService->addTemplateVariables($slotName, $currentVariables);

            $slotClosure = $slotService->getSlotClosure($slotName);
            $result = $slotClosure();

            $slotService->restoreTemplateVariables($slotName);
        }

        return $result;
    }
public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
    {
        /** @var FieldViewHelperService $fieldService */
        $fieldService = Core::instantiate(FieldViewHelperService::class);

        if (false === $fieldService->fieldContextExists()) {
            throw ContextNotFoundException::slotRenderViewHelperFieldContextNotFound();
        }

        /** @var SlotViewHelperService $slotService */
        $slotService = Core::instantiate(SlotViewHelperService::class);
        $slotName = $arguments['slot'];
        $result = '';

        if ($slotService->hasSlot($slotName)) {
            $currentVariables = version_compare(VersionNumberUtility::getCurrentTypo3Version(), '8.0.0', '<')
                ? $renderingContext->getTemplateVariableContainer()->getAll()
                : $renderingContext->getVariableProvider()->getAll();

            ArrayUtility::mergeRecursiveWithOverrule($currentVariables, $arguments['arguments']);

            $slotService->addTemplateVariables($slotName, $currentVariables);

            $slotClosure = $slotService->getSlotClosure($slotName);
            $result = $slotClosure();

            $slotService->restoreTemplateVariables($slotName);
        }

        return $result;
    }
public static function renderStatic ( array $ arguments , Closure $ renderChildrenClosure , RenderingContextInterface $ renderingContext ) { /** @var FieldViewHelperService $fieldService */ $ fieldService = Core :: instantiate ( FieldViewHelperService :: class ) ; if ( false === $ fieldService -> fieldContextExists ( ) ) { throw ContextNotFoundException :: slotRenderViewHelperFieldContextNotFound ( ) ; } /** @var SlotViewHelperService $slotService */ $ slotService = Core :: instantiate ( SlotViewHelperService :: class ) ; $ slotName = $ arguments [ 'slot' ] ; $ result = '' ; if ( $ slotService -> hasSlot ( $ slotName ) ) { $ currentVariables = version_compare ( VersionNumberUtility :: getCurrentTypo3Version ( ) , '8.0.0' , '<' ) ? $ renderingContext -> getTemplateVariableContainer ( ) -> getAll ( ) : $ renderingContext -> getVariableProvider ( ) -> getAll ( ) ; ArrayUtility :: mergeRecursiveWithOverrule ( $ currentVariables , $ arguments [ 'arguments' ] ) ; $ slotService -> addTemplateVariables ( $ slotName , $ currentVariables ) ; $ slotClosure = $ slotService -> getSlotClosure ( $ slotName ) ; $ result = $ slotClosure ( ) ; $ slotService -> restoreTemplateVariables ( $ slotName ) ; } return $ result ; }
Will render the slot with the given name, only if the slot is found.

@inheritdoc
Will render the slot with the given name only if the slot is found .