PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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
← All changes | classes/views/frm-form-actions/settings.php +259 -71 6.3 → trunk View file →
@@ -1,92 +1,280 @@
1 1 <?php
2 2 if ( ! defined( 'ABSPATH' ) ) {
3 3 die( 'You are not allowed to call this page directly.' );
4 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 +);
5 10 ?>
6 11 <p class="howto">
7 12 <?php esc_html_e( 'Add form actions to your form to perform tasks when an entry is created, updated, imported, and more.', 'formidable' ); ?>
8 13 </p>
9 14
10 -<div id="frm_email_addon_menu" class="frm-limited-actions">
11 - <?php
12 - FrmAppHelper::show_search_box(
13 - array(
14 - 'input_id' => 'actions',
15 - 'placeholder' => __( 'Search Form Actions', 'formidable' ),
16 - 'tosearch' => 'frm-action',
17 - )
18 - );
19 - ?>
20 - <h3 class="frm-no-border">
21 - <?php esc_html_e( 'Form Actions', 'formidable' ); ?>
22 - <span class="frm-sub-label">
23 - <?php esc_html_e( '(click an action to add it to your form)', 'formidable' ); ?>
24 - </span>
25 - </h3>
26 - <?php
27 - $displayed_actions = array();
28 - foreach ( $groups as $group_name => $group ) {
29 - if ( ! empty( $group['name'] ) ) {
30 - ?>
31 - <h3 class="frm-group-heading"><?php echo esc_html( $group['name'] ); ?></h3>
32 - <?php
33 - }
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>
34 31
35 - if ( ! isset( $group['actions'] ) ) {
36 - $group['actions'] = array();
37 - }
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 + );
38 41 ?>
39 - <ul class="frm_actions_list">
40 - <?php
41 - foreach ( $action_controls as $action_control ) {
42 - if ( in_array( $action_control->id_base, $displayed_actions ) || ! in_array( $action_control->id_base, $group['actions'] ) ) {
43 - continue;
44 - }
42 + </div>
45 43
46 - $displayed_actions[] = $action_control->id_base;
47 - FrmFormActionsController::show_action_icon_link( $action_control, $allowed );
48 - unset( $actions_icon, $classes );
49 - }
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 } ?>
50 62
51 - foreach ( $group['actions'] as $action ) {
52 - if ( in_array( $action, $displayed_actions ) ) {
53 - continue;
54 - }
55 - ?>
56 - <li class="frm-action frm-not-installed">
57 - <a href="javascript:void(0)" class="frm-single-action frm_show_upgrade">
58 - <span class="frm-outer-circle">
59 - <span class="frm-inner-circle" <?php FrmAppHelper::array_to_html_params( $icon_atts, true ); ?>>
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">
60 71 <?php
61 - $icon_atts = array();
62 - if ( isset( $group['color'] ) ) {
63 - $icon_atts = array(
64 - 'style' => '--primary-700:' . $group['color'],
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
65 107 );
66 - }
67 - FrmAppHelper::icon_by_class( 'frmfont frm_plus_icon', $icon_atts );
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-action-locked 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 + <span><?php esc_html_e( 'Upgrade', 'formidable' ); ?></span>
149 + </a>
150 + </div>
151 + </li>
152 + <?php
153 + }//end foreach
68 154 ?>
69 - </span>
70 - </span>
71 - <?php echo esc_html( $action ); ?>
72 - </a>
73 - </li>
155 + </ul>
156 + </div>
157 + <?php
158 + }//end foreach
159 + ?>
160 + </div>
74 161 <?php
75 - }
162 + continue;
163 + }//end if
164 +
165 + // Handle regular groups
76 166 ?>
77 - </ul>
167 + <div data-group="<?php echo esc_attr( $group_key ); ?>"<?php echo 'my_actions' === $group_key ? '' : ( 'misc' === $group_key ? ' class="frm_hidden"' : ' class="frm_hidden"' ); ?>>
168 + <?php if ( ! empty( $group['name'] ) ) { ?>
169 + <h3 class="frm-group-heading"><?php echo esc_html( $group['name'] ); ?></h3>
170 + <?php } ?>
171 +
172 + <?php
173 + if ( ! isset( $group['actions'] ) ) {
174 + $group['actions'] = array();
175 + }
176 +
177 + $icon_atts = isset( $group['color'] ) ? array( 'style' => '--primary-700:' . $group['color'] ) : array();
178 + ?>
179 + <ul class="frm_actions_list frm-list-grid-layout frm-m-0">
180 + <?php
181 + foreach ( $action_controls as $action_control ) {
182 + if ( ! in_array( $action_control->id_base, $group['actions'], true ) ) {
183 + continue;
184 + }
185 +
186 + FrmFormActionsController::show_action_icon_link( $action_control, $allowed );
187 + }
188 +
189 + // Build array of installed action IDs to skip in second loop
190 + $installed_action_ids = array();
191 +
192 + foreach ( $action_controls as $action_control ) {
193 + $installed_action_ids[] = $action_control->id_base;
194 + }
195 +
196 + foreach ( $group['actions'] as $action ) {
197 + // Skip if action is already installed (shown in first loop)
198 + if ( in_array( $action, $installed_action_ids, true ) ) {
199 + continue;
200 + }
201 +
202 + $icon_atts = array();
203 +
204 + if ( isset( $group['color'] ) ) {
205 + $icon_atts = array(
206 + 'style' => '--primary-700:' . $group['color'],
207 + );
208 + }
209 +
210 + $action_icon = $group['icon'] ?? 'frmfont frm_plus_icon';
211 +
212 + $single_action_attrs['data-upgrade'] = sprintf(
213 + /* translators: %s: Name of form action */
214 + __( '%s form actions', 'formidable' ),
215 + $action
216 + );
217 + $single_action_attrs['data-medium'] = 'settings-' . $action;
218 + $single_action_attrs['data-actiontype'] = $action;
219 +
220 + // Set limit for payment actions only if not installed
221 + if ( in_array( $action, array( 'paypal', 'stripe', 'square' ), true ) ) {
222 + // Check if this action is already installed
223 + $action_is_installed = false;
224 +
225 + foreach ( $action_controls as $action_control ) {
226 + if ( $action_control->id_base === $action ) {
227 + $action_is_installed = true;
228 + break;
229 + }
230 + }
231 +
232 + // Only set limit if action is not installed
233 + if ( ! $action_is_installed ) {
234 + $single_action_attrs['data-limit'] = 1;
235 + }
236 + }
237 + ?>
238 + <li class="frm-card-item frm-card-item--outlined frm-action frm-not-installed frm-action-locked frm-group-<?php echo esc_attr( $group_key ); ?>" tabindex="0">
239 + <div class="frm-h-stack-xs frm-w-full">
240 + <span class="frm-border-icon">
241 + <?php FrmAppHelper::icon_by_class( $action_icon, $icon_atts ); ?>
242 + </span>
243 +
244 + <div class="frm-flex-col frm-min-w-0">
245 + <h3 class="frm-h-stack-xs frm-text-md frm-capitalize">
246 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon frm_svg15', array( 'aria-label' => __( 'Lock icon', 'formidable' ) ) ); ?>
247 + <span class="frm-font-medium frm-truncate"><?php echo esc_html( $action ); ?></span>
248 + <?php
249 + if ( ! empty( $group['new_actions'] ) && in_array( $action, $group['new_actions'], true ) ) {
250 + FrmAppHelper::show_pill_text();
251 + }
252 + ?>
253 + </h3>
254 + </div>
255 +
256 + <a <?php FrmAppHelper::array_to_html_params( $single_action_attrs, true ); ?>>
257 + <span><?php esc_html_e( 'Upgrade', 'formidable' ); ?></span>
258 + </a>
259 + </div>
260 + </li>
261 + <?php
262 + }//end foreach
263 + ?>
264 + </ul>
265 + </div>
78 266 <?php
79 - }
80 - ?>
81 - <div class="clear"></div>
82 - <a href="#" id="frm-show-groups">
83 - <?php esc_html_e( 'Show all form actions', 'formidable' ); ?>
84 - </a>
85 - <a href="#" id="frm-hide-groups">
86 - <?php esc_html_e( 'Hide extra form actions', 'formidable' ); ?>
87 - </a>
88 - <div class="clear"></div>
267 + }//end foreach
268 + ?>
269 +
270 + <p id="frm-actions-no-results" class="frm_hidden frm-mt-0">
271 + <?php esc_html_e( 'No actions found. Try a different search term.', 'formidable' ); ?>
272 + </p>
273 + </div>
89 274 </div>
90 275
91 -<?php FrmFormActionsController::list_actions( $form, $values ); ?>
92 -<?php FrmTipsHelper::pro_tip( 'get_form_action_tip', 'p' ); ?>
276 +<h3 class="frm-mt-xl"><?php esc_html_e( 'Current Actions', 'formidable' ); ?></h3>
277 +
278 +<?php
279 +FrmFormActionsController::list_actions( $form, $values );
280 +FrmTipsHelper::pro_tip( 'get_form_action_tip', 'p' );