| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace Opentalent\OtTemplating\ViewHelpers\Request;
- 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 {
- public function initializeArguments()
- {
- $this->registerArgument('argument',
- 'string',
- "The argument's name",
- true);
- }
- /**
- * @param array $arguments
- * @param \Closure $renderChildrenClosure
- * @param RenderingContextInterface $renderingContext
- * @return int|null
- */
- public static function renderStatic(
- array $arguments,
- \Closure $renderChildrenClosure,
- RenderingContextInterface $renderingContext
- ) {
- $argument = $arguments['argument'];
- if (isset($_REQUEST[$argument])) {
- return $_REQUEST[$argument];
- }
- return null;
- }
- }
|