PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.2
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 / form-manager.php
jetformbuilder / includes Last commit date
actions 1 month ago addons 11 months ago admin 3 weeks ago blocks 2 weeks ago classes 2 weeks ago db-queries 2 weeks ago exceptions 2 years ago form-messages 1 year ago form-patterns 2 years ago form-response 2 years ago generators 2 months ago migrations 1 month ago presets 2 weeks ago request 2 years ago autoloader.php 1 year ago file-upload.php 2 years ago form-break.php 2 years ago form-handler.php 11 months ago form-manager.php 2 months ago functions.php 2 years ago live-form.php 2 years ago plugin.php 2 years ago
form-manager.php
95 lines
1 <?php
2
3
4 namespace Jet_Form_Builder;
5
6 use Jet_Form_Builder\Blocks\Block_Helper;
7 use Jet_Form_Builder\Generators\Get_From_DB;
8 use Jet_Form_Builder\Generators\Get_From_Rest_Api;
9 use Jet_Form_Builder\Generators\Get_From_Users;
10 use Jet_Form_Builder\Generators\Get_Related_Posts;
11 use Jet_Form_Builder\Generators\Num_Range;
12 use Jet_Form_Builder\Generators\Num_Range_Manual;
13
14 // If this file is called directly, abort.
15 if ( ! defined( 'WPINC' ) ) {
16 die();
17 }
18
19 class Form_Manager {
20
21 public $generators = false;
22 public $builder;
23
24 const NAMESPACE_FIELDS = 'jet-forms/';
25
26 /**
27 * Returns all instances of options generators classes
28 *
29 * @return [type] [description]
30 */
31 public function get_options_generators() {
32
33 if ( false === $this->generators ) {
34
35 $instances = apply_filters(
36 'jet-form-builder/forms/options-generators',
37 array(
38 new Num_Range(),
39 new Num_Range_Manual(),
40 new Get_From_DB(),
41 new Get_From_Users(),
42 new Get_Related_Posts(),
43 new Get_From_Rest_Api(),
44 ),
45 $this
46 );
47
48 $this->generators = array();
49
50 foreach ( $instances as $instance ) {
51 if ( $instance->can_generate() ) {
52 $this->generators[ $instance->get_id() ] = $instance;
53 }
54 }
55 }
56
57 return $this->generators;
58 }
59
60
61 /**
62 * Returns generators list
63 *
64 * @return [type] [description]
65 */
66 public function get_generators_list() {
67
68 $generators = $this->get_options_generators();
69 $result = array(
70 0 => __( 'Select function...', 'jet-form-builder' ),
71 );
72
73 foreach ( $generators as $id => $generator ) {
74 $result[ $id ] = $generator->get_name();
75 }
76
77 return $result;
78 }
79
80 public function get_only_form_fields( $form_id ): array {
81 $content = Block_Helper::get_blocks_by_post( $form_id );
82
83 return Block_Helper::filter_blocks_by_namespace( $content );
84 }
85
86 public function get_field_by_name( $form_id, $field_name, $blocks = array() ): array {
87 if ( ! $blocks ) {
88 $blocks = Block_Helper::get_blocks_by_post( $form_id );
89 }
90
91 return Block_Helper::find_block_by_name( $field_name, $blocks );
92 }
93
94 }
95