| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace Opentalent\OtTemplating\ViewHelpers\Request;
- use Closure;
- use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
- use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
- /**
- * Check if an argument with this name was passed trough the request.
- * If this is the case, returns this argument's value; if not returns null.
- *
- * {namespace ot=Opentalent\OtTemplating\ViewHelpers}
- *
- * {ot:request.getArgument('name')}
- *
- * @package Opentalent\OtTemplating\ViewHelpers
- */
- class GetArgumentViewHelper extends AbstractViewHelper {
- /**
- * -- This method is expected by Fluid --
- * Declares the viewhelper's parameters
- */
- public function initializeArguments()
- {
- $this->registerArgument('argument',
- 'string',
- "The argument's name",
- true);
- }
- /**
- * -- 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
- ) {
- $argument = $arguments['argument'];
- if (isset($_REQUEST[$argument])) {
- return $_REQUEST[$argument];
- }
- return null;
- }
- }
|