PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.2.2
JetFormBuilder — Dynamic Blocks Form Builder v3.2.2
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 All 130 releases
jetformbuilder / modules / block-parsers / fields / datetime-trait.php
datetime-trait.php
47 lines 908 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace JFB_Modules\Block_Parsers\Fields;
5
6 // If this file is called directly, abort.
7 if ( ! defined( 'WPINC' ) ) {
8 die;
9 }
10
11 trait Datetime_Trait {
12
13 public function update_request() {
14 parent::update_request();
15
16 if ( $this->get_errors() ||
17 ! $this->get_value() ||
18 ! $this->get_setting( 'is_timestamp' )
19 ) {
20 return;
21 }
22
23 $this->set_value( strtotime( $this->value ) );
24 }
25
26 public function iterate_row_value(): \Generator {
27 if ( ! $this->get_value() || ! $this->get_setting( 'is_timestamp' ) ) {
28 yield from parent::iterate_row_value();
29
30 return;
31 }
32
33 /**
34 * CSV cannot perceive a large number normally,
35 * so we have to let it know that this is a text, and this is a number.
36 *
37 * @since 3.2.2
38 * @see https://github.com/Crocoblock/issues-tracker/issues/5734
39 */
40 $this->set_value( $this->get_value() . "\t" );
41
42 yield from parent::iterate_row_value();
43 }
44
45
46 }
47