PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.33.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.33.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 / views / frm-form-actions / settings.php

settings.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.33.1, at classes/views/frm-form-actions/settings.php

283 lines 9.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 $single_action_attrs = array(
7 'href' => 'javascript:void(0)',
8 'class' => 'frm_single_action frm_inactive_action frm_show_upgrade button frm-button-secondary frm-button-sm frm-with-icon frm-ml-auto-force frm-fadein-down-short',
9 );
10 ?>
11 <p class="howto">
12 <?php esc_html_e( 'Add form actions to your form to perform tasks when an entry is created, updated, imported, and more.', 'formidable' ); ?>
13 </p>
14
15 <div id="frm_email_addon_menu" class="frm-mt-md">
16 <div class="frm-h-stack frm-mb-lg">
17 <div class="frm-style-tabs-wrapper" data-filter-target="#frm-actions-filter-content">
18 <div class="frm-tabs-delimiter"><span class="frm-tabs-active-underline"></span></div>
19 <div class="frm-tabs-navs">
20 <ul class="frm-h-stack-xs frm-children-px-sm">
21 <li class="frm-active" data-filter="my_actions"><?php esc_html_e( 'My Actions', 'formidable' ); ?></li>
22 <li data-filter="all"><?php esc_html_e( 'All', 'formidable' ); ?></li>
23 <?php foreach ( $groups as $group_key => $group ) { ?>
24 <?php if ( ! empty( $group['name'] ) && 'my_actions' !== $group_key ) { ?>
25 <li data-filter="<?php echo esc_attr( $group_key ); ?>"><?php echo esc_html( $group['name'] ); ?></li>
26 <?php } ?>
27 <?php } ?>
28 </ul>
29 </div>
30 </div>
31
32 <?php
33 FrmAppHelper::show_search_box(
34 array(
35 'input_id' => 'actions',
36 'placeholder' => __( 'Search Actions', 'formidable' ),
37 'tosearch' => 'frm-action',
38 'class' => 'frm-ml-auto-force',
39 )
40 );
41 ?>
42 </div>
43
44 <div id="frm-actions-filter-content" data-active-filter="my_actions">
45 <?php
46 foreach ( $groups as $group_key => $group ) {
47 // Handle my_actions group with sections
48 if ( 'my_actions' === $group_key && isset( $group['sections'] ) ) {
49 ?>
50 <div data-group="<?php echo esc_attr( $group_key ); ?>">
51 <?php
52 foreach ( $group['sections'] as $section_key => $section ) {
53 // Skip section if it has no actions
54 if ( empty( $section['actions'] ) ) {
55 continue;
56 }
57 ?>
58 <div data-section="<?php echo esc_attr( $section_key ); ?>">
59 <?php if ( ! empty( $section['name'] ) ) { ?>
60 <h3 class="frm-group-heading"><?php echo esc_html( $section['name'] ); ?></h3>
61 <?php } ?>
62
63 <?php
64 if ( ! isset( $section['actions'] ) ) {
65 $section['actions'] = array();
66 }
67
68 $icon_atts = isset( $group['color'] ) ? array( 'style' => '--primary-700:' . $group['color'] ) : array();
69 ?>
70 <ul class="frm_actions_list frm-list-grid-layout frm-m-0">
71 <?php
72 foreach ( $action_controls as $action_control ) {
73 if ( ! in_array( $action_control->id_base, $section['actions'], true ) ) {
74 continue;
75 }
76
77 FrmFormActionsController::show_action_icon_link( $action_control, $allowed );
78 }
79
80 // Build array of installed action IDs to skip in second loop
81 $installed_action_ids = array();
82
83 foreach ( $action_controls as $action_control ) {
84 $installed_action_ids[] = $action_control->id_base;
85 }
86
87 foreach ( $section['actions'] as $action ) {
88 // Skip if action is already installed (shown in first loop)
89 if ( in_array( $action, $installed_action_ids, true ) ) {
90 continue;
91 }
92
93 $icon_atts = array();
94
95 if ( isset( $group['color'] ) ) {
96 $icon_atts = array(
97 'style' => '--primary-700:' . $group['color'],
98 );
99 }
100
101 $action_icon = $group['icon'] ?? 'frmfont frm_plus_icon';
102
103 $single_action_attrs['data-upgrade'] = sprintf(
104 /* translators: %s: Name of form action */
105 __( '%s form actions', 'formidable' ),
106 $action
107 );
108 $single_action_attrs['data-medium'] = 'settings-' . $action;
109 $single_action_attrs['data-actiontype'] = $action;
110
111 // Set limit for payment actions only if not installed
112 if ( in_array( $action, array( 'paypal', 'stripe', 'square' ), true ) ) {
113 // Check if this action is already installed
114 $action_is_installed = false;
115
116 foreach ( $action_controls as $action_control ) {
117 if ( $action_control->id_base === $action ) {
118 $action_is_installed = true;
119 break;
120 }
121 }
122
123 // Only set limit if action is not installed
124 if ( ! $action_is_installed ) {
125 $single_action_attrs['data-limit'] = 1;
126 }
127 }
128 ?>
129 <li class="frm-card-item frm-card-item--outlined frm-action frm-not-installed frm-group-<?php echo esc_attr( $group_key ); ?>" tabindex="0">
130 <div class="frm-h-stack-xs frm-w-full">
131 <span class="frm-border-icon">
132 <?php FrmAppHelper::icon_by_class( $action_icon, $icon_atts ); ?>
133 </span>
134
135 <div class="frm-flex-col frm-min-w-0">
136 <h3 class="frm-h-stack-xs frm-text-md frm-capitalize">
137 <?php FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon frm_svg15', array( 'aria-label' => __( 'Lock icon', 'formidable' ) ) ); ?>
138 <span class="frm-font-medium frm-truncate"><?php echo esc_html( $action ); ?></span>
139 <?php
140 if ( ! empty( $section['new_actions'] ) && in_array( $action, $section['new_actions'], true ) ) {
141 FrmAppHelper::show_pill_text();
142 }
143 ?>
144 </h3>
145 </div>
146
147 <a <?php FrmAppHelper::array_to_html_params( $single_action_attrs, true ); ?>>
148 <?php FrmAppHelper::icon_by_class( 'frmfont frm_plus_icon' ); ?>
149 <span><?php echo esc_html_x( 'Add', 'form action', 'formidable' ); ?></span>
150 </a>
151 </div>
152 </li>
153 <?php
154 }//end foreach
155 ?>
156 </ul>
157 </div>
158 <?php
159 }//end foreach
160 ?>
161 </div>
162 <?php
163 continue;
164 }//end if
165
166 // Handle regular groups
167 ?>
168 <div data-group="<?php echo esc_attr( $group_key ); ?>"<?php echo 'my_actions' === $group_key ? '' : ( 'misc' === $group_key ? ' class="frm_hidden"' : ' class="frm_hidden"' ); ?>>
169 <?php if ( ! empty( $group['name'] ) ) { ?>
170 <h3 class="frm-group-heading"><?php echo esc_html( $group['name'] ); ?></h3>
171 <?php } ?>
172
173 <?php
174 if ( ! isset( $group['actions'] ) ) {
175 $group['actions'] = array();
176 }
177
178 $icon_atts = isset( $group['color'] ) ? array( 'style' => '--primary-700:' . $group['color'] ) : array();
179 ?>
180 <ul class="frm_actions_list frm-list-grid-layout frm-m-0">
181 <?php
182 foreach ( $action_controls as $action_control ) {
183 if ( ! in_array( $action_control->id_base, $group['actions'], true ) ) {
184 continue;
185 }
186
187 FrmFormActionsController::show_action_icon_link( $action_control, $allowed );
188 }
189
190 // Build array of installed action IDs to skip in second loop
191 $installed_action_ids = array();
192
193 foreach ( $action_controls as $action_control ) {
194 $installed_action_ids[] = $action_control->id_base;
195 }
196
197 foreach ( $group['actions'] as $action ) {
198 // Skip if action is already installed (shown in first loop)
199 if ( in_array( $action, $installed_action_ids, true ) ) {
200 continue;
201 }
202
203 $icon_atts = array();
204
205 if ( isset( $group['color'] ) ) {
206 $icon_atts = array(
207 'style' => '--primary-700:' . $group['color'],
208 );
209 }
210
211 $action_icon = $group['icon'] ?? 'frmfont frm_plus_icon';
212
213 $single_action_attrs['data-upgrade'] = sprintf(
214 /* translators: %s: Name of form action */
215 __( '%s form actions', 'formidable' ),
216 $action
217 );
218 $single_action_attrs['data-medium'] = 'settings-' . $action;
219 $single_action_attrs['data-actiontype'] = $action;
220
221 // Set limit for payment actions only if not installed
222 if ( in_array( $action, array( 'paypal', 'stripe', 'square' ), true ) ) {
223 // Check if this action is already installed
224 $action_is_installed = false;
225
226 foreach ( $action_controls as $action_control ) {
227 if ( $action_control->id_base === $action ) {
228 $action_is_installed = true;
229 break;
230 }
231 }
232
233 // Only set limit if action is not installed
234 if ( ! $action_is_installed ) {
235 $single_action_attrs['data-limit'] = 1;
236 }
237 }
238 ?>
239 <li class="frm-card-item frm-card-item--outlined frm-action frm-not-installed frm-group-<?php echo esc_attr( $group_key ); ?>" tabindex="0">
240 <div class="frm-h-stack-xs frm-w-full">
241 <span class="frm-border-icon">
242 <?php FrmAppHelper::icon_by_class( $action_icon, $icon_atts ); ?>
243 </span>
244
245 <div class="frm-flex-col frm-min-w-0">
246 <h3 class="frm-h-stack-xs frm-text-md frm-capitalize">
247 <?php FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon frm_svg15', array( 'aria-label' => __( 'Lock icon', 'formidable' ) ) ); ?>
248 <span class="frm-font-medium frm-truncate"><?php echo esc_html( $action ); ?></span>
249 <?php
250 if ( ! empty( $group['new_actions'] ) && in_array( $action, $group['new_actions'], true ) ) {
251 FrmAppHelper::show_pill_text();
252 }
253 ?>
254 </h3>
255 </div>
256
257 <a <?php FrmAppHelper::array_to_html_params( $single_action_attrs, true ); ?>>
258 <?php FrmAppHelper::icon_by_class( 'frmfont frm_plus_icon' ); ?>
259 <span><?php echo esc_html_x( 'Add', 'form action', 'formidable' ); ?></span>
260 </a>
261 </div>
262 </li>
263 <?php
264 }//end foreach
265 ?>
266 </ul>
267 </div>
268 <?php
269 }//end foreach
270 ?>
271
272 <p id="frm-actions-no-results" class="frm_hidden frm-mt-0">
273 <?php esc_html_e( 'No actions found. Try a different search term.', 'formidable' ); ?>
274 </p>
275 </div>
276 </div>
277
278 <h3 class="frm-mt-xl"><?php esc_html_e( 'Current Actions', 'formidable' ); ?></h3>
279
280 <?php
281 FrmFormActionsController::list_actions( $form, $values );
282 FrmTipsHelper::pro_tip( 'get_form_action_tip', 'p' );
283