checkbox.php
3 weeks ago
date.php
3 weeks ago
datetime.php
3 weeks ago
field.php
3 weeks ago
gallery.php
3 weeks ago
media.php
3 weeks ago
number.php
3 weeks ago
post.php
3 weeks ago
radio.php
3 weeks ago
repeater.php
3 weeks ago
select.php
3 weeks ago
switcher.php
3 weeks ago
text.php
3 weeks ago
time.php
3 weeks ago
toggle.php
3 weeks ago
user.php
3 weeks ago
text.php
19 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Wpae\AddonAPI; |
| 4 | |
| 5 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 6 | |
| 7 | class PMXE_Addon_Text_Field extends PMXE_Addon_Field { |
| 8 | |
| 9 | public function toString() { |
| 10 | // There are some cases where the value is not a string and we don't know why. |
| 11 | // The text field is the default field for unknown types, so we'll just cast it to a string. |
| 12 | if ( ! is_string( $this->value ) ) { |
| 13 | return json_encode( $this->value ); |
| 14 | } |
| 15 | |
| 16 | return trim( $this->value ); |
| 17 | } |
| 18 | } |
| 19 |