| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace Opentalent\OtTemplating\ViewHelpers\Template;
- use Closure;
- use Opentalent\OtTemplating\Utilities\OtPageRepository;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
- use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
- /**
- * Returns the name of the current template
- *
- * {namespace ot=Opentalent\OtTemplating\ViewHelpers}
- *
- * {ot:template.current()}
- *
- * @package Opentalent\OtTemplating\ViewHelpers\Template
- */
- class CurrentViewHelper extends AbstractViewHelper
- {
- /**
- * -- 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
- ) {
- if (TYPO3_MODE == 'FE') {
- $pageUid = (int) $GLOBALS['TSFE']->id;
- } else {
- $pageUid = (int) GeneralUtility::_GP('id');
- }
- $pageRepository = new OtPageRepository();
- return $pageRepository->getCurrentTemplate($pageUid);
- }
- }
|