PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.26.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.26.1
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / models / fields / FrmFieldSubmit.php

FrmFieldSubmit.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.26.1, at classes/models/fields/FrmFieldSubmit.php

126 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Submit field class
4 *
5 * @since 6.9
6 *
7 * @package Formidable
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 die( 'You are not allowed to call this page directly.' );
12 }
13
14 /**
15 * @since 6.9
16 */
17 class FrmFieldSubmit extends FrmFieldType {
18
19 /**
20 * Field type.
21 *
22 * @var string
23 */
24 protected $type = FrmSubmitHelper::FIELD_TYPE;
25
26 /**
27 * Has for label or not?
28 *
29 * @var bool
30 */
31 protected $has_for_label = false;
32
33 /**
34 * Has input or not?
35 *
36 * @var bool
37 */
38 protected $has_input = false;
39
40 /**
41 * Default HTML.
42 *
43 * @return string
44 */
45 public function default_html() {
46 $default_html = <<<DEFAULT_HTML
47 <div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]">
48 [input]
49 </div>
50 DEFAULT_HTML;
51
52 return $default_html;
53 }
54
55 /**
56 * Sets settings for this field type.
57 *
58 * @return array
59 */
60 protected function field_settings_for_type() {
61 $settings = array(
62 'required' => false,
63 'visibility' => false,
64 'label_position' => false,
65 'options' => false,
66 'default' => false,
67 'description' => false,
68 'logic' => true,
69 );
70
71 return $settings;
72 }
73
74 /**
75 * Includes form builder file.
76 *
77 * @return string
78 */
79 protected function include_form_builder_file() {
80 return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-submit.php';
81 }
82
83 /**
84 * Shows label on form builder.
85 */
86 public function show_label_on_form_builder() {
87 // Do nothing.
88 }
89
90 /**
91 * Gets frontend field input.
92 *
93 * @param array $args Args.
94 * @param array $shortcode_atts Shortcode atts.
95 *
96 * @return string
97 */
98 public function front_field_input( $args, $shortcode_atts ) {
99 $form = $args['form'];
100
101 if ( ! FrmForm::show_submit( $form ) ) {
102 return '';
103 }
104
105 $submit = $this->field['name'];
106 $form_action = FrmSubmitHelper::get_current_action_from_global_var( $form->id );
107 $values = FrmAppHelper::setup_edit_vars( $form, 'forms' );
108
109 ob_start();
110
111 /**
112 * @since 5.5.1
113 */
114 do_action( 'frm_before_submit_btn', compact( 'form' ) );
115
116 FrmFormsHelper::get_custom_submit( $values['submit_html'], $form, $submit, $form_action, $values );
117
118 /**
119 * @since 5.5.1
120 */
121 do_action( 'frm_after_submit_btn', compact( 'form' ) );
122
123 return ob_get_clean();
124 }
125 }
126