Completed
Branch unit-test-view-helpers (ccaf92)
by Romain
01:50
created

FormViewHelper::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 21

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
/*
3
 * 2016 Romain CANON <[email protected]>
4
 *
5
 * This file is part of the TYPO3 Formz project.
6
 * It is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU General Public License, either
8
 * version 3 of the License, or any later version.
9
 *
10
 * For the full copyright and license information, see:
11
 * http://www.gnu.org/licenses/gpl-3.0.html
12
 */
13
14
namespace Romm\Formz\ViewHelpers\Legacy;
15
16
/**
17
 * Legacy version of the `FormViewHelper` for TYPO3 6.2+ and 7.6+, used to
18
 * register arguments the "old" way: in the DocBlock of the `render()` function.
19
 */
20
class FormViewHelper extends \Romm\Formz\ViewHelpers\FormViewHelper
21
{
22
    /**
23
     * Render the form.
24
     *
25
     * @param string $action                               Target action
26
     * @param array  $arguments                            Arguments
27
     * @param string $controller                           Target controller
28
     * @param string $extensionName                        Target Extension Name (without "tx_" prefix and no underscores). If NULL the current extension name is used
29
     * @param string $pluginName                           Target plugin. If empty, the current plugin name is used
30
     * @param int    $pageUid                              Target page uid
31
     * @param mixed  $object                               Object to use for the form. Use in conjunction with the "property" attribute on the sub tags
32
     * @param int    $pageType                             Target page type
33
     * @param bool   $noCache                              set this to disable caching for the target page. You should not need this.
34
     * @param bool   $noCacheHash                          set this to suppress the cHash query parameter created by TypoLink. You should not need this.
35
     * @param string $section                              The anchor to be added to the action URI (only active if $actionUri is not set)
36
     * @param string $format                               The requested format (e.g. ".html") of the target page (only active if $actionUri is not set)
37
     * @param array  $additionalParams                     additional action URI query parameters that won't be prefixed like $arguments (overrule $arguments) (only active if $actionUri is not set)
38
     * @param bool   $absolute                             If set, an absolute action URI is rendered (only active if $actionUri is not set)
39
     * @param bool   $addQueryString                       If set, the current query parameters will be kept in the action URI (only active if $actionUri is not set)
40
     * @param array  $argumentsToBeExcludedFromQueryString arguments to be removed from the action URI. Only active if $addQueryString = TRUE and $actionUri is not set
41
     * @param string $fieldNamePrefix                      Prefix that will be added to all field names within this form. If not set the prefix will be tx_yourExtension_plugin
42
     * @param string $actionUri                            can be used to overwrite the "action" attribute of the form tag
43
     * @param string $objectName                           name of the object that is bound to this form. If this argument is not specified, the name attribute of this form is used to determine the FormObjectName
44
     * @param string $hiddenFieldClassName
45
     * @param string $addQueryStringMethod
46
     * @return string rendered form
47
     */
48
    public function render($action = null, array $arguments = [], $controller = null, $extensionName = null, $pluginName = null, $pageUid = null, $object = null, $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $format = '', array $additionalParams = [], $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = [], $fieldNamePrefix = null, $actionUri = null, $objectName = null, $hiddenFieldClassName = null, $addQueryStringMethod = '')
49
    {
50
        return call_user_func_array([get_parent_class(), 'render'], func_get_args());
51
    }
52
}
53