PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.10
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.10
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.10, at classes/models/fields/FrmFieldSubmit.php

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