| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace Opentalent\OtTemplating\ViewHelpers\RootPage;
- use FluidTYPO3\Vhs\Service\PageService;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3\CMS\Extbase\Object\ObjectManager;
- use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
- use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
- /**
- * Viewhelper to retrieve the Uri to the current site root page
- * Call it in fluid templates with:
- *
- * {namespace ot=Opentalent\OtTemplating\ViewHelpers}
- *
- * {ot:rootPage.getUri()}
- *
- * @package Opentalent\OtTemplating\ViewHelpers
- */
- class GetUriViewHelper extends AbstractViewHelper
- {
- public function initializeArguments()
- {
- }
- /**
- * @param array $arguments
- * @param \Closure $renderChildrenClosure
- * @param RenderingContextInterface $renderingContext
- * @return string
- */
- public static function renderStatic(
- array $arguments,
- \Closure $renderChildrenClosure,
- RenderingContextInterface $renderingContext
- ) {
- $pageUid = GetIdViewHelper::renderStatic($arguments, $renderChildrenClosure, $renderingContext);
- $uriBuilder = $renderingContext->getControllerContext()->getUriBuilder();
- $uri = $uriBuilder->setTargetPageUid($pageUid)->build();
- return $uri;
- }
- }
|