|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* TActiveHiddenField class file. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Carl G. Mathisen <[email protected]> |
|
6
|
|
|
* @link https://github.com/pradosoft/prado |
|
7
|
|
|
* @license https://github.com/pradosoft/prado/blob/master/LICENSE |
|
8
|
|
|
* @package Prado\Web\UI\ActiveControls |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Prado\Web\UI\ActiveControls; |
|
12
|
|
|
|
|
13
|
|
|
use Prado\Prado; |
|
14
|
|
|
use Prado\Web\UI\WebControls\THiddenField; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* TActiveHiddenField class |
|
18
|
|
|
* |
|
19
|
|
|
* TActiveHiddenField displays a hidden input field on a Web page. |
|
20
|
|
|
* The value of the input field can be accessed via {@link getValue Value} property. |
|
21
|
|
|
* |
|
22
|
|
|
* @author Carl G. Mathisen <[email protected]> |
|
23
|
|
|
* @package Prado\Web\UI\ActiveControls |
|
24
|
|
|
* @since 3.1 |
|
25
|
|
|
*/ |
|
26
|
|
|
class TActiveHiddenField extends THiddenField implements IActiveControl |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* Creates a new callback control, sets the adapter to |
|
30
|
|
|
* TActiveControlAdapter. If you override this class, be sure to set the |
|
31
|
|
|
* adapter appropriately by, for example, by calling this constructor. |
|
32
|
|
|
*/ |
|
33
|
1 |
|
public function __construct() |
|
34
|
|
|
{ |
|
35
|
1 |
|
parent::__construct(); |
|
36
|
1 |
|
$this->setAdapter(new TActiveControlAdapter($this)); |
|
37
|
1 |
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @return TBaseActiveCallbackControl standard callback control options. |
|
41
|
|
|
*/ |
|
42
|
1 |
|
public function getActiveControl() |
|
43
|
|
|
{ |
|
44
|
1 |
|
return $this->getAdapter()->getBaseActiveControl(); |
|
|
|
|
|
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @return TCallbackClientSide client side request options. |
|
49
|
|
|
*/ |
|
50
|
|
|
public function getClientSide() |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->getAdapter()->getBaseActiveControl()->getClientSide(); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Client-side Value property can only be updated after the OnLoad stage. |
|
57
|
|
|
* @param string $value text content for the hidden field |
|
58
|
|
|
*/ |
|
59
|
1 |
|
public function setValue($value) |
|
60
|
|
|
{ |
|
61
|
1 |
|
if (parent::getValue() === $value) { |
|
62
|
|
|
return; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
1 |
|
parent::setValue($value); |
|
66
|
1 |
|
if ($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) { |
|
67
|
|
|
$this->getPage()->getCallbackClient()->setValue($this, $value); |
|
68
|
|
|
} |
|
69
|
1 |
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|