PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 1.3.1
JetFormBuilder — Dynamic Blocks Form Builder v1.3.1
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 / includes / request / field-data-parser.php
jetformbuilder / includes / request Last commit date
fields 4 years ago current-parsers.php 4 years ago field-data-parser.php 4 years ago parser-manager.php 4 years ago request-handler.php 4 years ago
field-data-parser.php
67 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Request;
5
6
7 use Jet_Form_Builder\Blocks\Modules\Fields_Errors\Error_Handler;
8 use Jet_Form_Builder\Exceptions\Request_Exception;
9
10 abstract class Field_Data_Parser {
11
12 protected $value;
13 protected $is_required = false;
14 protected $name = 'field_name';
15 protected $block;
16 protected $settings;
17 protected $inner;
18 protected $request_handler;
19 protected $inside_conditional;
20
21 abstract public function type();
22
23 public function get_response() {
24 return $this->value;
25 }
26
27 public function _is_custom_check() {
28 return false;
29 }
30
31 final public function response() {
32 if ( $this->_is_required() || $this->_is_custom_check() ) {
33 $this->save_error();
34 }
35
36 return $this->get_response();
37 }
38
39 public function init( $value, $block, $inside_conditional ) {
40 $this->value = $value;
41 $this->block = $block;
42
43 $this->inside_conditional = $inside_conditional;
44 $this->settings = $this->block['attrs'];
45 $this->inner = $this->block['innerBlocks'];
46
47
48 if ( isset( $this->settings['required'] ) ) {
49 $this->is_required = $this->settings['required'];
50 }
51 if ( isset( $this->settings['name'] ) ) {
52 $this->name = $this->settings['name'];
53 }
54 }
55
56 private function _is_required() {
57 return ( ! $this->inside_conditional && $this->is_required && empty( $this->value ) );
58 }
59
60 private function save_error() {
61 Error_Handler::instance()->add(
62 $this->type(), array( 'name' => $this->name, 'params' => $this->settings )
63 );
64 }
65
66
67 }