1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* 2017 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\Exceptions; |
15
|
|
|
|
16
|
|
|
use Romm\Formz\ViewHelpers\FieldViewHelper; |
17
|
|
|
use Romm\Formz\ViewHelpers\FormIdentifierHashViewHelper; |
18
|
|
|
use Romm\Formz\ViewHelpers\FormViewHelper; |
19
|
|
|
use Romm\Formz\ViewHelpers\OptionViewHelper; |
20
|
|
|
use Romm\Formz\ViewHelpers\Slot\HasViewHelper; |
21
|
|
|
use Romm\Formz\ViewHelpers\Slot\RenderViewHelper; |
22
|
|
|
use Romm\Formz\ViewHelpers\SlotViewHelper; |
23
|
|
|
use Romm\Formz\ViewHelpers\SubstepViewHelper; |
24
|
|
|
|
25
|
|
|
class ContextNotFoundException extends FormzException |
26
|
|
|
{ |
27
|
|
|
const FORM_CONTEXT_NOT_FOUND = 'The view helper "%s" must be used inside the view helper "%s".'; |
28
|
|
|
|
29
|
|
|
const FIELD_CONTEXT_NOT_FOUND = 'The view helper "%s" must be used inside the view helper "%s".'; |
30
|
|
|
|
31
|
|
|
const FORM_IDENTIFIER_FORM_CONTEXT_NOT_FOUND = 'The form context was not found for the view helper "%". You must either fill the arguments `form` and `name`, or use this view helper inside "%s"'; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @code 1465243085 |
35
|
|
|
* |
36
|
|
|
* @return self |
37
|
|
|
*/ |
38
|
|
|
final public static function fieldViewHelperFormContextNotFound() |
39
|
|
|
{ |
40
|
|
|
/** @var self $exception */ |
41
|
|
|
$exception = self::getNewExceptionInstance( |
42
|
|
|
self::FORM_CONTEXT_NOT_FOUND, |
43
|
|
|
[FieldViewHelper::class, FormViewHelper::class] |
44
|
|
|
); |
45
|
|
|
|
46
|
|
|
return $exception; |
47
|
|
|
} |
48
|
|
|
/** |
49
|
|
|
* @code 1494337489 |
50
|
|
|
* |
51
|
|
|
* @return self |
52
|
|
|
*/ |
53
|
|
|
final public static function substepViewHelperFormContextNotFound() |
54
|
|
|
{ |
55
|
|
|
/** @var self $exception */ |
56
|
|
|
$exception = self::getNewExceptionInstance( |
57
|
|
|
self::FORM_CONTEXT_NOT_FOUND, |
58
|
|
|
[SubstepViewHelper::class, FormViewHelper::class] |
59
|
|
|
); |
60
|
|
|
|
61
|
|
|
return $exception; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @code 1465243287 |
66
|
|
|
* |
67
|
|
|
* @return self |
68
|
|
|
*/ |
69
|
|
|
final public static function optionViewHelperFieldContextNotFound() |
70
|
|
|
{ |
71
|
|
|
/** @var self $exception */ |
72
|
|
|
$exception = self::getNewExceptionInstance( |
73
|
|
|
self::FIELD_CONTEXT_NOT_FOUND, |
74
|
|
|
[OptionViewHelper::class, FieldViewHelper::class] |
75
|
|
|
); |
76
|
|
|
|
77
|
|
|
return $exception; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @code 1488473956 |
82
|
|
|
* |
83
|
|
|
* @return self |
84
|
|
|
*/ |
85
|
|
|
final public static function slotRenderViewHelperFieldContextNotFound() |
86
|
|
|
{ |
87
|
|
|
/** @var self $exception */ |
88
|
|
|
$exception = self::getNewExceptionInstance( |
89
|
|
|
self::FIELD_CONTEXT_NOT_FOUND, |
90
|
|
|
[RenderViewHelper::class, FieldViewHelper::class] |
91
|
|
|
); |
92
|
|
|
|
93
|
|
|
return $exception; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @code 1488474106 |
98
|
|
|
* |
99
|
|
|
* @return self |
100
|
|
|
*/ |
101
|
|
|
final public static function slotViewHelperFieldContextNotFound() |
102
|
|
|
{ |
103
|
|
|
/** @var self $exception */ |
104
|
|
|
$exception = self::getNewExceptionInstance( |
105
|
|
|
self::FIELD_CONTEXT_NOT_FOUND, |
106
|
|
|
[SlotViewHelper::class, FieldViewHelper::class] |
107
|
|
|
); |
108
|
|
|
|
109
|
|
|
return $exception; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @code 1488988566 |
114
|
|
|
* |
115
|
|
|
* @return self |
116
|
|
|
*/ |
117
|
|
|
final public static function slotHasViewHelperFieldContextNotFound() |
118
|
|
|
{ |
119
|
|
|
/** @var self $exception */ |
120
|
|
|
$exception = self::getNewExceptionInstance( |
121
|
|
|
self::FIELD_CONTEXT_NOT_FOUND, |
122
|
|
|
[HasViewHelper::class, FieldViewHelper::class] |
123
|
|
|
); |
124
|
|
|
|
125
|
|
|
return $exception; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @code 1490960228 |
130
|
|
|
* |
131
|
|
|
* @return self |
132
|
|
|
*/ |
133
|
|
|
final public static function formIdentifierViewHelperFormContextNotFound() |
134
|
|
|
{ |
135
|
|
|
/** @var self $exception */ |
136
|
|
|
$exception = self::getNewExceptionInstance( |
137
|
|
|
self::FORM_IDENTIFIER_FORM_CONTEXT_NOT_FOUND, |
138
|
|
|
[FormIdentifierHashViewHelper::class, FormViewHelper::class] |
139
|
|
|
); |
140
|
|
|
|
141
|
|
|
return $exception; |
142
|
|
|
} |
143
|
|
|
} |
144
|
|
|
|