| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace Opentalent\OtTemplating\ViewHelpers\EventsPage;
- use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
- use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
- /**
- * Retrieves and returns the Uri to the events page of the current site
- * The events page is the first page found with 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
- {
- /**
- * -- This method is expected by Fluid --
- * Renders the content as html
- *
- * @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;
- }
- }
|