| @@ -1,282 +1,94 @@ | ||
| 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 | -); | |
| 10 | 5 | ?> |
| 11 | 6 | <p class="howto"> |
| 12 | 7 | <?php esc_html_e( 'Add form actions to your form to perform tasks when an entry is created, updated, imported, and more.', 'formidable' ); ?> |
| 13 | 8 | </p> |
| 14 | 9 | |
| 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> | |
| 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 | + } | |
| 31 | 34 | |
| 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 | - ); | |
| 35 | + if ( ! isset( $group['actions'] ) ) { | |
| 36 | + $group['actions'] = array(); | |
| 37 | + } | |
| 41 | 38 | ?> |
| 42 | - </div> | |
| 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 | + } | |
| 43 | 45 | |
| 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'] ) ) { | |
| 46 | + $displayed_actions[] = $action_control->id_base; | |
| 47 | + FrmFormActionsController::show_action_icon_link( $action_control, $allowed ); | |
| 48 | + unset( $actions_icon, $classes ); | |
| 49 | + } | |
| 50 | + | |
| 51 | + foreach ( $group['actions'] as $action ) { | |
| 52 | + if ( in_array( $action, $displayed_actions ) ) { | |
| 53 | + continue; | |
| 54 | + } | |
| 49 | 55 | ?> |
| 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"> | |
| 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 | |
| 60 | + echo FrmAppHelper::array_to_html_params( $icon_atts ); // WPCS: XSS ok. | |
| 61 | + ?>> | |
| 71 | 62 | <?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 ); | |
| 63 | + $icon_atts = array(); | |
| 64 | + if ( isset( $group['color'] ) ) { | |
| 65 | + $icon_atts = array( | |
| 66 | + 'style' => '--primary-hover:' . $group['color'], | |
| 67 | + ); | |
| 78 | 68 | } |
| 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 | |
| 69 | + FrmAppHelper::icon_by_class( 'frmfont frm_plus_icon', $icon_atts ); | |
| 155 | 70 | ?> |
| 156 | - </ul> | |
| 157 | - </div> | |
| 158 | - <?php | |
| 159 | - }//end foreach | |
| 160 | - ?> | |
| 161 | - </div> | |
| 71 | + </span> | |
| 72 | + </span> | |
| 73 | + <?php echo esc_html( $action ); ?> | |
| 74 | + </a> | |
| 75 | + </li> | |
| 162 | 76 | <?php |
| 163 | - continue; | |
| 164 | - }//end if | |
| 165 | - | |
| 166 | - // Handle regular groups | |
| 77 | + } | |
| 167 | 78 | ?> |
| 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> | |
| 79 | + </ul> | |
| 268 | 80 | <?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> | |
| 81 | + } | |
| 82 | + ?> | |
| 83 | + <div class="clear"></div> | |
| 84 | + <a href="#" id="frm-show-groups"> | |
| 85 | + <?php esc_html_e( 'Show all form actions', 'formidable' ); ?> | |
| 86 | + </a> | |
| 87 | + <a href="#" id="frm-hide-groups"> | |
| 88 | + <?php esc_html_e( 'Hide extra form actions', 'formidable' ); ?> | |
| 89 | + </a> | |
| 90 | + <div class="clear"></div> | |
| 276 | 91 | </div> |
| 277 | 92 | |
| 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' ); | |
| 93 | +<?php FrmFormActionsController::list_actions( $form, $values ); ?> | |
| 94 | +<?php FrmTipsHelper::pro_tip( 'get_form_action_tip', 'p' ); ?> | |