PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5
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 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / block-parsers / fields / repeater-field-parser.php
jetformbuilder / modules / block-parsers / fields Last commit date
date-field-parser.php 2 years ago datetime-field-parser.php 2 years ago datetime-trait.php 2 years ago default-parser.php 1 week ago hidden-field-parser.php 3 weeks ago media-field-parser.php 1 week ago repeater-field-parser.php 1 week ago text-field-parser.php 2 years ago wysiwyg-field-parser.php 2 years ago
repeater-field-parser.php
72 lines
1 <?php
2
3
4 namespace JFB_Modules\Block_Parsers\Fields;
5
6 use Jet_Form_Builder\Request\Exceptions\Sanitize_Value_Exception;
7 use JFB_Modules\Block_Parsers\Field_Data_Parser;
8
9 // If this file is called directly, abort.
10 if ( ! defined( 'WPINC' ) ) {
11 die;
12 }
13
14 class Repeater_Field_Parser extends Field_Data_Parser {
15
16 public function type() {
17 return 'repeater-field';
18 }
19
20 protected function allows_array_value(): bool {
21 return true;
22 }
23
24 /**
25 * @return int|void
26 * @throws Sanitize_Value_Exception
27 */
28 public function get_response() {
29 $indexes = $this->get_indexes();
30
31 if ( ! $indexes ) {
32 return '';
33 }
34
35 if ( ! $this->get_inner_template() ) {
36 return -1;
37 }
38
39 foreach ( $indexes as $index ) {
40 $context = clone $this->get_inner_template();
41 $context->set_index_in_parent( $this->add_inner( $context ) );
42
43 $context->set_request( $this->value[ $index ] ?? array() )
44 ->set_files( $this->file[ $index ] ?? array() );
45
46 $context->apply();
47 }
48
49 $this->set_file( false );
50
51 return count( $indexes );
52 }
53
54 protected function get_indexes(): array {
55 if ( ! is_array( $this->value ) ) {
56 $this->value = array();
57 }
58 if ( ! is_array( $this->file ) ) {
59 $this->file = array();
60 }
61
62 $indexes = array_keys( $this->value );
63 $file_indexes = array_keys( $this->file );
64
65 /**
66 * @see https://github.com/Crocoblock/issues-tracker/issues/2095
67 */
68 return max( $indexes, $file_indexes );
69 }
70
71 }
72