| @@ -1,29 +1,83 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | + | |
| 6 | +$limit = $action_control->action_options['limit']; | |
| 7 | + | |
| 8 | +if ( 'paypal' === $action_control->id_base ) { | |
| 9 | + // The PayPal add-on may overwrite this so change it back. | |
| 10 | + $limit = 1; | |
| 11 | +} | |
| 12 | + | |
| 13 | +// Remove limit for Stripe action when Stripe add-on is active | |
| 14 | +if ( 'stripe' === $action_control->id_base && class_exists( 'FrmStrpAppHelper' ) ) { | |
| 15 | + $limit = 99; | |
| 16 | +} | |
| 17 | + | |
| 18 | +$single_action_attrs = array_merge( | |
| 19 | + $data, | |
| 20 | + array( | |
| 21 | + 'href' => 'javascript:void(0)', | |
| 22 | + 'class' => $classes . ' button frm-button-secondary frm-button-sm frm-with-icon frm-ml-auto-force frm-fadein-down-short', | |
| 23 | + 'data-limit' => $limit, | |
| 24 | + 'data-actiontype' => $action_control->id_base, | |
| 25 | + ) | |
| 26 | +); | |
| 27 | + | |
| 28 | +if ( 'paypal' === $action_control->id_base ) { | |
| 29 | + $action_control->name = 'PayPal Commerce'; | |
| 30 | +} | |
| 31 | + | |
| 32 | +// An action that needs a plan upgrade, as opposed to one this license can install with a single click. | |
| 33 | +$is_locked = isset( $data['data-upgrade'] ) && ! isset( $data['data-oneclick'] ); | |
| 34 | + | |
| 35 | +$li_classes = $group_class; | |
| 36 | + | |
| 37 | +if ( isset( $data['data-upgrade'] ) ) { | |
| 38 | + $li_classes .= ' frm-not-installed'; | |
| 39 | +} | |
| 40 | + | |
| 41 | +if ( $is_locked ) { | |
| 42 | + $li_classes .= ' frm-action-locked'; | |
| 43 | +} | |
| 5 | 44 | ?> |
| 6 | -<li class="frm-action <?php echo esc_attr( $group_class . ( isset( $data['data-upgrade'] ) ? ' frm-not-installed' : '' ) ); ?>"> | |
| 7 | - <a href="javascript:void(0)" class="<?php echo esc_attr( $classes ); ?>" | |
| 8 | - data-limit="<?php echo esc_attr( $action_control->action_options['limit'] ); ?>" | |
| 9 | - data-actiontype="<?php echo esc_attr( $action_control->id_base ); ?>" | |
| 10 | - <?php FrmAppHelper::array_to_html_params( $data, true ); ?> | |
| 11 | - > | |
| 12 | - <span class="frm-outer-circle"> | |
| 13 | - <span class="frm-inner-circle<?php echo esc_attr( strpos( $action_control->action_options['classes'], 'frm-inverse' ) === false ? '' : ' frm-inverse' ); ?>" <?php | |
| 14 | - FrmAppHelper::array_to_html_params( $icon_atts, true ); | |
| 15 | - ?>> | |
| 16 | - <?php FrmAppHelper::icon_by_class( $action_control->action_options['classes'], $icon_atts ); ?> | |
| 17 | - </span> | |
| 45 | +<li class="frm-card-item frm-card-item--outlined frm-action<?php echo esc_attr( $li_classes ); ?>" tabindex="0"> | |
| 46 | + <div class="frm-h-stack-xs frm-w-full"> | |
| 47 | + <span class="frm-border-icon frm-shrink-0"> | |
| 48 | + <?php FrmAppHelper::icon_by_class( $action_control->action_options['classes'], FrmFormActionsController::get_action_icon_atts( $action_control ) ); ?> | |
| 18 | 49 | </span> |
| 19 | - <?php echo esc_html( str_replace( 'Add to ', '', $action_control->name ) ); ?> | |
| 20 | - <?php if ( ! empty( $action_control->action_options['keywords'] ) ) { ?> | |
| 21 | - <span class="frm_hidden"> | |
| 50 | + | |
| 51 | + <div class="frm-flex-col frm-min-w-0"> | |
| 52 | + <h3 class="frm-h-stack-xs frm-capitalize"> | |
| 22 | 53 | <?php |
| 23 | - // Include keywords for the action search. | |
| 24 | - echo esc_html( $action_control->action_options['keywords'] ); | |
| 54 | + if ( $is_locked ) { | |
| 55 | + FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon frm_svg15', array( 'aria-label' => __( 'Lock icon', 'formidable' ) ) ); | |
| 56 | + } | |
| 25 | 57 | ?> |
| 26 | - </span> | |
| 58 | + <span class="frm-font-medium frm-white-space-nowrap"><?php echo esc_html( str_replace( 'Add to ', '', $action_control->name ) ); ?></span> | |
| 59 | + <?php if ( ! empty( $action_control->action_options['is_new'] ) ) { ?> | |
| 60 | + <?php FrmAppHelper::show_pill_text(); ?> | |
| 61 | + <?php } elseif ( ! empty( $action_control->action_options['is_beta'] ) ) { ?> | |
| 62 | + <?php FrmAppHelper::show_pill_text( __( 'BETA', 'formidable' ) ); ?> | |
| 63 | + <?php } ?> | |
| 64 | + </h3> | |
| 65 | + <?php if ( ! empty( $action_control->action_options['description'] ) ) { ?> | |
| 66 | + <p class="frm-truncate"><?php echo esc_html( $action_control->action_options['description'] ); ?></p> | |
| 67 | + <?php } ?> | |
| 68 | + </div> | |
| 69 | + | |
| 70 | + <a <?php FrmAppHelper::array_to_html_params( $single_action_attrs, true ); ?>> | |
| 71 | + <?php if ( $is_locked ) { ?> | |
| 72 | + <span><?php esc_html_e( 'Upgrade', 'formidable' ); ?></span> | |
| 73 | + <?php } else { ?> | |
| 74 | + <?php FrmAppHelper::icon_by_class( 'frmfont frm_plus_icon' ); ?> | |
| 75 | + <span><?php echo esc_html_x( 'Add', 'form action', 'formidable' ); ?></span> | |
| 76 | + <?php } ?> | |
| 77 | + </a> | |
| 78 | + | |
| 79 | + <?php if ( ! empty( $action_control->action_options['keywords'] ) ) { ?> | |
| 80 | + <span class="frm_hidden"><?php echo esc_html( $action_control->action_options['keywords'] ); ?></span> | |
| 27 | 81 | <?php } ?> |
| 28 | - </a> | |
| 82 | + </div> | |
| 29 | 83 | </li> |