[TASK] Move method arguments to initializeArguments() in ext:extensionmanager 72/48772/6
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 1 Jul 2016 15:03:01 +0000 (17:03 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 26 Jul 2016 08:27:52 +0000 (10:27 +0200)
Resolves: #76913
Releases: master
Change-Id: Ib9deb03af724bbbb3f782f8d0f109686d6ba9965
Reviewed-on: https://review.typo3.org/48772
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
17 files changed:
typo3/sysext/extensionmanager/Classes/ViewHelpers/Be/TriggerViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ConfigureExtensionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/DownloadExtensionDataViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/DownloadExtensionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/Form/TypoScriptConstantsViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/Format/ImplodeViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/Format/JsonEncodeViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ImageViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/InstallationStateCssClassViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/Link/ActionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ProcessAvailableActionsViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/RemoveExtensionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ShowExtensionVersionsViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/TimeSinceLastUpdateViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ToggleExtensionInstallationStateViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/Typo3DependencyViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/UpdateScriptViewHelper.php

index 6bbb946..39961d1 100644 (file)
@@ -34,19 +34,27 @@ use TYPO3\CMS\Extensionmanager\Controller\AbstractController;
 class TriggerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
 {
     /**
+     * Initializes the arguments
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('triggers', 'array', 'Defined triggers to be forwarded to client (e.g. refreshing backend widgets)', false, array());
+    }
+
+    /**
      * Loads some JS inline code based on a list of triggers. This is used to reload the main
      * menu when modules are loaded/unloaded.
      *
-     * @param array $triggers Defined triggers to be forwarded to client (e.g. refreshing backend widgets)
      * @return string This view helper does not return any content
      * @see \TYPO3\CMS\Backend\Template\DocumentTemplate
      * @see \TYPO3\CMS\Core\Page\PageRenderer
      */
-    public function render($triggers = array())
+    public function render()
     {
         $pageRenderer = $this->getPageRenderer();
         // Handle triggers
-        if (!empty($triggers[AbstractController::TRIGGER_RefreshModuleMenu])) {
+        if (!empty($this->arguments['triggers'][AbstractController::TRIGGER_RefreshModuleMenu])) {
             $pageRenderer->addJsInlineCode(
                 AbstractController::TRIGGER_RefreshModuleMenu,
                 'if (top && top.TYPO3.ModuleMenu.App) { top.TYPO3.ModuleMenu.App.refreshMenu(); }'
index 0db03af..738abc4 100644 (file)
@@ -26,15 +26,27 @@ use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 class ConfigureExtensionViewHelper extends Link\ActionViewHelper
 {
     /**
+     * Initialize arguments
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('extension', 'array', 'Extension configuration array with extension information', true);
+        $this->registerArgument('forceConfiguration', 'bool', 'If TRUE the content is only returned if a link could be generated', false, true);
+        $this->registerArgument('showDescription', 'bool', 'If TRUE the extension description is also shown in the title attribute', false, false);
+    }
+
+    /**
      * Renders a configure extension link if the extension has configuration options
      *
-     * @param array $extension Extension configuration array with extension information
-     * @param bool $forceConfiguration If TRUE the content is only returned if a link could be generated
-     * @param bool $showDescription If TRUE the extension description is also shown in the title attribute
      * @return string the rendered tag or child nodes content
      */
-    public function render($extension, $forceConfiguration = true, $showDescription = false)
+    public function render()
     {
+        $extension = $this->arguments['extension'];
+        $forceConfiguration = $this->arguments['forceConfiguration'];
+        $showDescription = $this->arguments['showDescription'];
+
         $content = (string)$this->renderChildren();
         if ($extension['installed'] && file_exists(PATH_site . $extension['siteRelPath'] . 'ext_conf_template.txt')) {
             $uriBuilder = $this->controllerContext->getUriBuilder();
index 036d4f4..345a900 100644 (file)
@@ -25,13 +25,24 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 class DownloadExtensionDataViewHelper extends Link\ActionViewHelper
 {
     /**
+     * Initialize arguments
+     *
+     * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('extension', 'array', '', true);
+    }
+
+    /**
      * Renders an install link
      *
-     * @param array $extension
      * @return string the rendered a tag
      */
-    public function render($extension)
+    public function render()
     {
+        $extension = $this->arguments['extension'];
         /** @var IconFactory $iconFactory */
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
 
index 2c46fcd..b9d2445 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Extensionmanager\ViewHelpers;
  */
 
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
+use TYPO3\CMS\Extensionmanager\Domain\Model\Extension;
 
 /**
  * view helper
@@ -55,12 +56,11 @@ class DownloadExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\Abst
 
     /**
      * Initialize arguments.
-     *
-     * @return void
      */
     public function initializeArguments()
     {
         parent::initializeArguments();
+        $this->registerArgument('extension', Extension::class, '', true);
         $this->registerTagAttribute('enctype', 'string', 'MIME type with which the form is submitted');
         $this->registerTagAttribute('method', 'string', 'Transfer type (GET or POST)');
         $this->registerTagAttribute('name', 'string', 'Name of form');
@@ -72,12 +72,13 @@ class DownloadExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\Abst
     /**
      * Renders a download link
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
      * @return string the rendered a tag
      */
-    public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
+    public function render()
     {
-        $installPaths = \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallPaths();
+        /** @var Extension $extension */
+        $extension = $this->arguments['extension'];
+        $installPaths = Extension::returnAllowedInstallPaths();
         if (empty($installPaths)) {
             return '';
         }
index 501b7d5..7f895c5 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Extensionmanager\ViewHelpers\Form;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem;
 use TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper;
 
 /**
@@ -48,26 +49,25 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
 
     /**
      * Initialize arguments of this view helper
-     *
-     * @return void
      */
     public function initializeArguments()
     {
         parent::initializeArguments();
         $this->registerArgument('name', 'string', 'Name of input tag');
         $this->registerArgument('value', 'mixed', 'Value of input tag');
+        $this->registerArgument('configuration', ConfigurationItem::class, '', true);
         $this->registerUniversalTagAttributes();
     }
 
     /**
      * Render
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
      * @return string the rendered tag
      */
-    public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    public function render()
     {
-        $input = '';
+        /** @var ConfigurationItem $configuration */
+        $configuration = $this->arguments['configuration'];
         if (isset($this->viewHelperMapping[$configuration->getType()]) && method_exists($this, $this->viewHelperMapping[$configuration->getType()])) {
             $input = $this->{$this->viewHelperMapping[$configuration->getType()]}($configuration);
         } else {
@@ -80,10 +80,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type color picker
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function renderColorPicker(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function renderColorPicker(ConfigurationItem $configuration)
     {
         $elementId = 'em-' . $configuration->getName();
         $elementName = $this->getName($configuration);
@@ -114,10 +114,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type "offset"
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function renderOffsetField(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function renderOffsetField(ConfigurationItem $configuration)
     {
         $this->tag->setTagName('input');
         $this->tag->addAttribute('type', 'text');
@@ -133,10 +133,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type "wrap"
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function renderWrapField(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function renderWrapField(ConfigurationItem $configuration)
     {
         $this->tag->setTagName('input');
         $this->tag->addAttribute('type', 'text');
@@ -152,10 +152,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type "option"
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function renderOptionSelect(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function renderOptionSelect(ConfigurationItem $configuration)
     {
         $this->tag->setTagName('select');
         $this->tag->addAttribute('id', 'em-' . $configuration->getName());
@@ -177,10 +177,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type "int+"
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function renderPositiveIntegerField(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function renderPositiveIntegerField(ConfigurationItem $configuration)
     {
         $this->tag->setTagName('input');
         $this->tag->addAttribute('type', 'number');
@@ -197,10 +197,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type "integer"
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function renderIntegerField(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function renderIntegerField(ConfigurationItem $configuration)
     {
         $this->tag->setTagName('input');
         $this->tag->addAttribute('type', 'number');
@@ -216,10 +216,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type "text"
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function renderTextField(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function renderTextField(ConfigurationItem $configuration)
     {
         $this->tag->setTagName('input');
         $this->tag->addAttribute('type', 'text');
@@ -235,10 +235,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type "small text"
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function renderSmallTextField(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function renderSmallTextField(ConfigurationItem $configuration)
     {
         return $this->renderTextField($configuration);
     }
@@ -246,10 +246,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type "checkbox"
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    public function renderCheckbox(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    public function renderCheckbox(ConfigurationItem $configuration)
     {
         $this->tag->addAttribute('type', 'checkbox');
         $this->tag->addAttribute('name', $this->getName($configuration));
@@ -265,10 +265,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render field of type "userFunc"
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function renderUserFunction(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function renderUserFunction(ConfigurationItem $configuration)
     {
         $userFunction = $configuration->getGeneric();
         $userFunctionParams = array(
@@ -282,10 +282,10 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Get Field Name
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
-    protected function getName(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration)
+    protected function getName(ConfigurationItem $configuration)
     {
         return 'tx_extensionmanager_tools_extensionmanagerextensionmanager[config][' . $configuration->getName() . '][value]';
     }
@@ -293,7 +293,7 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
     /**
      * Render a hidden field for empty values
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem $configuration
+     * @param ConfigurationItem $configuration
      * @return string
      */
     protected function renderHiddenFieldForEmptyValue($configuration)
index 7611521..f33db8c 100644 (file)
@@ -24,20 +24,24 @@ use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
 class ImplodeViewHelper extends AbstractViewHelper
 {
     /**
+     * Initialize arguments of this view helper
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('implode', 'array', '', true);
+        $this->registerArgument('delimiter', 'string', '', false, ', ');
+    }
+
+    /**
      * Implodes a string
      *
-     * @param array $implode
-     * @param string $delimiter
      * @return string the altered string.
-     * @api
      */
-    public function render(array $implode, $delimiter = ', ')
+    public function render()
     {
         return static::renderStatic(
-            array(
-                'implode' => $implode,
-                'delimiter' => $delimiter,
-            ),
+            $this->arguments,
             $this->buildRenderChildrenClosure(),
             $this->renderingContext
         );
index f44bce6..97761e8 100644 (file)
@@ -33,12 +33,11 @@ class JsonEncodeViewHelper extends AbstractViewHelper
     protected $escapeChildren = false;
 
     /**
-     * Constructor
-     *
-     * @api
+     * Initialize arguments
      */
-    public function __construct()
+    public function initializeArguments()
     {
+        parent::initializeArguments();
         $this->registerArgument('additionalAttributes', 'array', 'Additional tag attributes. They will be added directly to the resulting HTML tag.', false);
     }
 
@@ -46,7 +45,6 @@ class JsonEncodeViewHelper extends AbstractViewHelper
      * Replaces newline characters by HTML line breaks.
      *
      * @return string the altered string.
-     * @api
      */
     public function render()
     {
index da779f6..7b7df4e 100644 (file)
@@ -48,12 +48,14 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV
 
     /**
      * Initialize arguments.
-     *
-     * @return void
      */
     public function initializeArguments()
     {
         parent::initializeArguments();
+        $this->registerArgument('src', 'string', '', true);
+        $this->registerArgument('width', 'int', 'width of the image');
+        $this->registerArgument('height', 'int', 'height of the image');
+        $this->registerArgument('fallbackImage', 'string', 'an optional fallback image if the $src image cannot be loaded', false, '');
         $this->registerUniversalTagAttributes();
         $this->registerTagAttribute('alt', 'string', 'Specifies an alternate text for an image', false);
     }
@@ -61,14 +63,15 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV
     /**
      * Resizes a given image (if required) and renders the respective img tag
      *
-     * @param string $src
-     * @param int $width width of the image
-     * @param int $height height of the image
-     * @param string $fallbackImage an optional fallback image if the $src image cannot be loaded
      * @return string rendered tag.
      */
-    public function render($src, $width = null, $height = null, $fallbackImage = '')
+    public function render()
     {
+        $src = $this->arguments['src'];
+        $width = $this->arguments['width'];
+        $height = $this->arguments['height'];
+        $fallbackImage = $this->arguments['fallbackImage'];
+
         $content = '';
         $uri = $this->getImageUri($src);
 
index be9271a..6f7c610 100644 (file)
@@ -25,22 +25,27 @@ use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
 class InstallationStateCssClassViewHelper extends AbstractViewHelper
 {
     /**
+     * Initialize arguments
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('needle', 'string', '', true);
+        $this->registerArgument('haystack', 'array', '', true);
+    }
+
+    /**
      * Returns string meant to be used as css class
      * 'installed' => if an extension is installed
      * 'available' => if an extension is available in the system
      * '' (empty string) => if neither installed nor available
      *
-     * @param string $needle
-     * @param array $haystack
      * @return string the rendered a tag
      */
-    public function render($needle, array $haystack)
+    public function render()
     {
         return static::renderStatic(
-            array(
-                'needle' => $needle,
-                'haystack' => $haystack,
-            ),
+            $this->arguments,
             $this->buildRenderChildrenClosure(),
             $this->renderingContext
         );
index 137f36e..41976f5 100644 (file)
@@ -28,8 +28,6 @@ class ActionViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBased
 
     /**
      * Arguments initialization
-     *
-     * @return void
      */
     public function initializeArguments()
     {
index 9e6ecc8..b19cb03 100644 (file)
@@ -37,13 +37,22 @@ class ProcessAvailableActionsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper
     }
 
     /**
+     * Initialize arguments
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('extension', 'string', '', true);
+    }
+
+    /**
      * Processes the list of actions.
      *
-     * @param string $extension
      * @return string the rendered list of actions
      */
-    public function render($extension)
+    public function render()
     {
+        $extension = $this->arguments['extension'];
         $html = $this->renderChildren();
         $actions = preg_split('#\\n\\s*#s', trim($html));
 
index 83625d9..876de22 100644 (file)
@@ -25,13 +25,24 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 class RemoveExtensionViewHelper extends Link\ActionViewHelper
 {
     /**
+     * Initialize arguments
+     *
+     * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('extension', 'array', '', true);
+    }
+
+    /**
      * Renders an install link
      *
-     * @param array $extension
      * @return string the rendered a tag
      */
-    public function render($extension)
+    public function render()
     {
+        $extension = $this->arguments['extension'];
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extension['key'])) {
             return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
index c0522d6..0e93750 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Extensionmanager\ViewHelpers;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extensionmanager\Domain\Model\Extension;
+
 /**
  * Display a link to show all versions of an extension
  * @internal
@@ -26,13 +28,24 @@ class ShowExtensionVersionsViewHelper extends Link\ActionViewHelper
     protected $tagName = 'a';
 
     /**
+     * Initialize arguments
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('extension', Extension::class, '', true);
+    }
+
+    /**
      * Renders an install link
      *
-     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
      * @return string the rendered a tag
      */
-    public function render($extension)
+    public function render()
     {
+        /** @var Extension $extension */
+        $extension = $this->arguments['extension'];
+
         $uriBuilder = $this->controllerContext->getUriBuilder();
         $action = 'showAllVersions';
         $uri = $uriBuilder->reset()->uriFor($action, array(
index ace1b74..df8485a 100644 (file)
@@ -26,17 +26,23 @@ use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
 class TimeSinceLastUpdateViewHelper extends AbstractViewHelper
 {
     /**
+     * Initialize arguments
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('lastUpdateTime', \DateTime::class, 'The date of the last update.', true);
+    }
+
+    /**
      * Render method
      *
-     * @param \DateTime $lastUpdateTime The date of the last update.
      * @return string
      */
-    public function render($lastUpdateTime)
+    public function render()
     {
         return static::renderStatic(
-            array(
-                'lastUpdateTime' => $lastUpdateTime,
-            ),
+            $this->arguments,
             $this->buildRenderChildrenClosure(),
             $this->renderingContext
         );
index 12409c8..f0ffec3 100644 (file)
@@ -32,13 +32,22 @@ class ToggleExtensionInstallationStateViewHelper extends Link\ActionViewHelper
     protected $tagName = 'a';
 
     /**
+     * Initialize arguments
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('extension', 'array', '', true);
+    }
+
+    /**
      * Renders an install link
      *
-     * @param array $extension
      * @return string the rendered a tag
      */
-    public function render($extension)
+    public function render()
     {
+        $extension = $this->arguments['extension'];
         // Early return if package is protected or is a runtime actived package and can not be unloaded
         /** @var $packageManager \TYPO3\CMS\Core\Package\PackageManager */
         $packageManager = $this->objectManager->get(PackageManager::class);
index 45a62a9..3c32f1d 100644 (file)
@@ -36,17 +36,25 @@ class Typo3DependencyViewHelper extends AbstractViewHelper
     protected $escapeOutput = false;
 
     /**
+     * Initialize arguments
+     *
+     * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('extension', Extension::class, '', true);
+    }
+
+    /**
      * Finds and returns the suitable TYPO3 versions of an extension
      *
-     * @param Extension $extension
      * @return string
      */
-    public function render(Extension $extension)
+    public function render()
     {
         return static::renderStatic(
-            array(
-                'extension' => $extension,
-            ),
+            $this->arguments,
             $this->buildRenderChildrenClosure(),
             $this->renderingContext
         );
index 4bc77a9..07e7a6d 100644 (file)
@@ -38,13 +38,22 @@ class UpdateScriptViewHelper extends Link\ActionViewHelper
     }
 
     /**
+     * initialize arguments
+     */
+    public function initializeArguments()
+    {
+        parent::initializeArguments();
+        $this->registerArgument('extensionKey', 'string', 'Extension key', true);
+    }
+
+    /**
      * Renders a link to the update script screen if the extension has one
      *
-     * @param string $extensionKey Extension key
      * @return string The rendered a tag
      */
-    public function render($extensionKey)
+    public function render()
     {
+        $extensionKey = $this->arguments['extensionKey'];
         $tag = '';
 
         // If the "class.ext_update.php" file exists, build link to the update script screen