| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace Opentalent\OtTemplating\ViewHelpers\Template;
- use Closure;
- use Opentalent\OtCore\ViewHelpers\OtAbstractViewHelper;
- use Opentalent\OtCore\Website\OtWebsiteRepository;
- use Opentalent\OtTemplating\Templating\TemplateRepository;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3\CMS\Extbase\Object\ObjectManager;
- use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
- /**
- * Returns the name of the current template
- *
- * {namespace ot=Opentalent\OtTemplating\ViewHelpers}
- *
- * {ot:template.current()}
- *
- * @package Opentalent\OtTemplating\ViewHelpers\Template
- */
- class CurrentViewHelper extends OtAbstractViewHelper
- {
- /**
- * -- This method is expected by Fluid --
- * Renders the content as html
- *
- * @param array $arguments
- * @param Closure $renderChildrenClosure
- * @param RenderingContextInterface $renderingContext
- * @return int|null
- */
- public static function renderStatic(
- array $arguments,
- Closure $renderChildrenClosure,
- RenderingContextInterface $renderingContext
- ) {
- $pageRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(OtWebsiteRepository::class);
- $website = $pageRepository->getCurrentWebsiteFromFEGlobals();
- $templateRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(TemplateRepository::class);
- return $templateRepository->getTemplate($website);
- }
- }
|