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\Exceptions; |
15
|
|
|
|
16
|
|
|
use Romm\Formz\ViewHelpers\FieldViewHelper; |
17
|
|
|
use Romm\Formz\ViewHelpers\FormViewHelper; |
18
|
|
|
use Romm\Formz\ViewHelpers\OptionViewHelper; |
19
|
|
|
use Romm\Formz\ViewHelpers\RenderSectionViewHelper; |
20
|
|
|
use Romm\Formz\ViewHelpers\SectionViewHelper; |
21
|
|
|
|
22
|
|
|
class ContextNotFoundException extends FormzException |
23
|
|
|
{ |
24
|
|
|
const FORM_CONTEXT_NOT_FOUND = 'The view helper "%s" must be used inside the view helper "%s".'; |
25
|
|
|
|
26
|
|
|
const FIELD_CONTEXT_NOT_FOUND = 'The view helper "%s" must be used inside the view helper "%s".'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @code 1465243085 |
30
|
|
|
* |
31
|
|
|
* @return ContextNotFoundException |
32
|
|
|
*/ |
33
|
|
|
final public static function fieldViewHelperFormContextNotFound() |
34
|
|
|
{ |
35
|
|
|
/** @var self $exception */ |
36
|
|
|
$exception = self::getNewExceptionInstance( |
37
|
|
|
self::FORM_CONTEXT_NOT_FOUND, |
38
|
|
|
[FieldViewHelper::class, FormViewHelper::class] |
39
|
|
|
); |
40
|
|
|
|
41
|
|
|
return $exception; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @code 1465243287 |
46
|
|
|
* |
47
|
|
|
* @return ContextNotFoundException |
48
|
|
|
*/ |
49
|
|
|
final public static function optionViewHelperFieldContextNotFound() |
50
|
|
|
{ |
51
|
|
|
/** @var self $exception */ |
52
|
|
|
$exception = self::getNewExceptionInstance( |
53
|
|
|
self::FIELD_CONTEXT_NOT_FOUND, |
54
|
|
|
[OptionViewHelper::class, FieldViewHelper::class] |
55
|
|
|
); |
56
|
|
|
|
57
|
|
|
return $exception; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @code 1488473956 |
62
|
|
|
* |
63
|
|
|
* @return ContextNotFoundException |
64
|
|
|
*/ |
65
|
|
|
final public static function renderSectionViewHelperFieldContextNotFound() |
66
|
|
|
{ |
67
|
|
|
/** @var self $exception */ |
68
|
|
|
$exception = self::getNewExceptionInstance( |
69
|
|
|
self::FIELD_CONTEXT_NOT_FOUND, |
70
|
|
|
[RenderSectionViewHelper::class, FieldViewHelper::class] |
71
|
|
|
); |
72
|
|
|
|
73
|
|
|
return $exception; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @code 1488474106 |
78
|
|
|
* |
79
|
|
|
* @return ContextNotFoundException |
80
|
|
|
*/ |
81
|
|
|
final public static function sectionViewHelperFieldContextNotFound() |
82
|
|
|
{ |
83
|
|
|
/** @var self $exception */ |
84
|
|
|
$exception = self::getNewExceptionInstance( |
85
|
|
|
self::FIELD_CONTEXT_NOT_FOUND, |
86
|
|
|
[SectionViewHelper::class, FieldViewHelper::class] |
87
|
|
|
); |
88
|
|
|
|
89
|
|
|
return $exception; |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|