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
|
|
|
use Romm\Formz\ViewHelpers\FormViewHelper; |
|
|
|
|
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Legacy version of the `FormViewHelper` for TYPO3 6.2+ and 7.6+, used to |
20
|
|
|
* register arguments the "old" way: in the DocBlock of the `render()` function. |
21
|
|
|
*/ |
22
|
|
|
class OldFormViewHelper extends FormViewHelper |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Render the form. |
26
|
|
|
* |
27
|
|
|
* @param string $action Target action |
28
|
|
|
* @param array $arguments Arguments |
29
|
|
|
* @param string $controller Target controller |
30
|
|
|
* @param string $extensionName Target Extension Name (without "tx_" prefix and no underscores). If NULL the current extension name is used |
31
|
|
|
* @param string $pluginName Target plugin. If empty, the current plugin name is used |
32
|
|
|
* @param int $pageUid Target page uid |
33
|
|
|
* @param mixed $object Object to use for the form. Use in conjunction with the "property" attribute on the sub tags |
34
|
|
|
* @param int $pageType Target page type |
35
|
|
|
* @param bool $noCache set this to disable caching for the target page. You should not need this. |
36
|
|
|
* @param bool $noCacheHash set this to suppress the cHash query parameter created by TypoLink. You should not need this. |
37
|
|
|
* @param string $section The anchor to be added to the action URI (only active if $actionUri is not set) |
38
|
|
|
* @param string $format The requested format (e.g. ".html") of the target page (only active if $actionUri is not set) |
39
|
|
|
* @param array $additionalParams additional action URI query parameters that won't be prefixed like $arguments (overrule $arguments) (only active if $actionUri is not set) |
40
|
|
|
* @param bool $absolute If set, an absolute action URI is rendered (only active if $actionUri is not set) |
41
|
|
|
* @param bool $addQueryString If set, the current query parameters will be kept in the action URI (only active if $actionUri is not set) |
42
|
|
|
* @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the action URI. Only active if $addQueryString = TRUE and $actionUri is not set |
43
|
|
|
* @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 |
44
|
|
|
* @param string $actionUri can be used to overwrite the "action" attribute of the form tag |
45
|
|
|
* @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 |
46
|
|
|
* @param string $hiddenFieldClassName |
47
|
|
|
* @param string $addQueryStringMethod |
48
|
|
|
* @return string rendered form |
49
|
|
|
*/ |
50
|
|
|
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 = '') |
51
|
|
|
{ |
52
|
|
|
return call_user_func_array([get_parent_class(), 'renderViewHelper'], func_get_args()); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: