| 1 | <?php |
||
| 2 | namespace EWW\Dpf\ViewHelpers; |
||
| 3 | |||
| 4 | /* |
||
| 5 | * This file is part of the TYPO3 CMS project. |
||
| 6 | * |
||
| 7 | * It is free software; you can redistribute it and/or modify it under |
||
| 8 | * the terms of the GNU General Public License, either version 2 |
||
| 9 | * of the License, or any later version. |
||
| 10 | * |
||
| 11 | * For the full copyright and license information, please read the |
||
| 12 | * LICENSE.txt file that was distributed with this source code. |
||
| 13 | * |
||
| 14 | * The TYPO3 project - inspiring people to share! |
||
| 15 | */ |
||
| 16 | |||
| 17 | class ActiveManagerMenuViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper |
||
| 18 | { |
||
| 19 | |||
| 20 | public function initializeArguments() |
||
| 21 | { |
||
| 22 | parent::initializeArguments(); |
||
| 23 | |||
| 24 | $this->registerArgument('controllerName', 'string', |
||
| 25 | 'The controller to be active.', true |
||
| 26 | ); |
||
| 27 | $this->registerArgument('actionNames', 'array', |
||
| 28 | 'The actions to be active.', false, [] |
||
| 29 | ); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return string |
||
| 34 | */ |
||
| 35 | public function render() |
||
| 36 | { |
||
| 37 | $controllerName = $this->arguments['controllerName']; |
||
| 38 | $actionNames = $this->arguments['actionNames']; |
||
| 39 | |||
| 40 | $controllerContext = $this->renderingContext->getControllerContext(); |
||
|
0 ignored issues
–
show
|
|||
| 41 | |||
| 42 | if ($controllerContext->getRequest()->getControllerName() == $controllerName) { |
||
| 43 | |||
| 44 | if (empty($actionNames)) { |
||
| 45 | return 'active'; |
||
| 46 | } elseif (in_array($controllerContext->getRequest()->getControllerActionName(), $actionNames)) { |
||
| 47 | return 'active'; |
||
| 48 | } else { |
||
| 49 | return ''; |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | return ''; |
||
| 54 | } |
||
| 55 | |||
| 56 | } |
||
| 57 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.