/
FormSuccessDisplayTag.php
96 lines (88 loc) · 2.6 KB
/
FormSuccessDisplayTag.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
namespace APF\tools\form\taglib;
/**
* <!--
* This file is part of the adventure php framework (APF) published under
* http://adventure-php-framework.org.
*
* The APF is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The APF is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the APF. If not, see http://www.gnu.org/licenses/lgpl-3.0.txt.
* -->
*/
/**
* @package APF\tools\form\taglib
* @class FormSuccessDisplayTag
*
* Implements a taglib, that outputs it's content, in case the form, the
* tag is defined in, is sent *and* valid. This let's you easily define
* form success messages. The definition of the tag is as follows:
* <pre>
* <form:success>
* The content to display, in case the form is sent *and* valid!
* [<success:getstring namespace="" config="" key="" />]
* [<success:placeholder name="" />]
* [<success:addtaglib namespace="" class="" prefix="" name="" />]
* </form:success>
* </pre>
*
* @author Christian Achatz
* @version
* Version 0.1, 30.12.2009<br />
*/
class FormSuccessDisplayTag extends AbstractFormControl {
/**
* @public
*
* Overwrites the parent's method, because there is nothing to do except
* analyzing the child tags.
*
* @author Christian Achatz
* @version
* Version 0.1, 30.12.2009<br />
*/
public function onParseTime() {
$this->extractTagLibTags();
}
/**
* @public
*
* Overwrites the parent's method, because there is nothing to do here.
*
* @author Christian Achatz
* @version
* Version 0.1, 30.12.2009<br />
*/
public function onAfterAppend() {
}
/**
* @public
*
* Outputs the content of the tag, if the form, the tag is
* defined in is sent *and* valid!
*
* @return string The content of the tag.
*
* @author Christian Achatz
* @version
* Version 0.1, 30.12.2009<br />
*/
public function transform() {
/* @var $form HtmlFormTag */
$form = $this->getParentObject();
if ($form->isSent() && $form->isValid()) {
$this->transformChildren();
return $this->content;
}
return '';
}
}