PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.0.5
JetFormBuilder — Dynamic Blocks Form Builder v3.0.5
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 / includes / shortcodes / form-shortcode.php

form-shortcode.php in JetFormBuilder — Dynamic Blocks Form Builder 3.0.5, at includes/shortcodes/form-shortcode.php

51 lines 944 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace Jet_Form_Builder\Shortcodes;
5
6 use Jet_Form_Builder\Classes\Arguments\Form_Arguments;
7
8 class Form_Shortcode extends Shortcode {
9
10 /**
11 * @return mixed
12 */
13 public function get_name() {
14 return 'jet_fb_form';
15 }
16
17 public function default_args() {
18 return $this->prepare_attributes(
19 jet_form_builder()->blocks->get_form_class()->get_attributes()
20 );
21 }
22
23 protected function prepare_attributes( $attrs ): array {
24 $result = array();
25 $arguments = new Form_Arguments();
26
27 foreach ( $attrs as $name => $attr ) {
28 if ( ! array_key_exists( $name, $arguments->props ) ) {
29 continue;
30 }
31
32 $result[ $name ] = $attr['default'];
33 }
34
35 return $result;
36 }
37
38 /**
39 * @param $settings
40 *
41 * @return mixed
42 */
43 public function generate( $settings ) {
44 $form = jet_form_builder()->blocks->get_form_class();
45
46 return $form->render_callback_field( $settings );
47 }
48
49
50 }
51