| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace Opentalent\OtTemplating\ViewHelpers\EventsPage;
- use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
- use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
- /**
- * Viewhelper to retrieve the Uri to the current site events page
- * The events page is the first page found which has the template 'OpenTalent.OtTemplating->events'
- * Return an empty string if no such page is found
- *
- * Call it in fluid templates with:
- *
- * {namespace ot=Opentalent\OtTemplating\ViewHelpers}
- *
- * {ot:eventsPage.getUri()}
- *
- * @package Opentalent\OtTemplating\ViewHelpers
- */
- class GetUriViewHelper extends AbstractViewHelper
- {
- public function initializeArguments()
- {
- }
- /**
- * @param array $arguments
- * @param \Closure $renderChildrenClosure
- * @param RenderingContextInterface $renderingContext
- * @return string|null
- */
- public static function renderStatic(
- array $arguments,
- \Closure $renderChildrenClosure,
- RenderingContextInterface $renderingContext
- ) {
- $pageUid = GetIdViewHelper::renderStatic($arguments, $renderChildrenClosure, $renderingContext);
- if ($pageUid == null) {
- return '';
- }
- $uriBuilder = $renderingContext->getControllerContext()->getUriBuilder();
- $uri = $uriBuilder->setTargetPageUid($pageUid)->build();
- return $uri;
- }
- }
|