| 1 |
<?php |
| 2 |
/** |
| 3 |
* Show a disabled preview of the Pro email attachment settings. |
| 4 |
* |
| 5 |
* Each control opens the upgrade modal with its own utm_medium so we can tell |
| 6 |
* which attachment type people are upgrading for. |
| 7 |
* |
| 8 |
* @since 6.35 |
| 9 |
* |
| 10 |
* @package Formidable |
| 11 |
* |
| 12 |
* @var string $action_key The unique key for the current form action. |
| 13 |
*/ |
| 14 |
|
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
die( 'You are not allowed to call this page directly.' ); |
| 17 |
} |
| 18 |
|
| 19 |
$file_params = array( |
| 20 |
'class' => 'button frm-button-secondary frm-button-sm frm_noallow frm_show_upgrade', |
| 21 |
'data-upgrade' => __( 'Email attachments', 'formidable' ), |
| 22 |
'data-message' => __( 'Attach a file of your choice to every email this form sends.', 'formidable' ), |
| 23 |
'data-medium' => 'email-attachment-file', |
| 24 |
'data-content' => 'attachment-file', |
| 25 |
); |
| 26 |
|
| 27 |
$toggle_upsells = array( |
| 28 |
array( |
| 29 |
'id' => 'frm_attach_csv_' . $action_key, |
| 30 |
'label' => __( 'Attach CSV export of entry to email', 'formidable' ), |
| 31 |
'data-upgrade' => __( 'CSV email attachments', 'formidable' ), |
| 32 |
'data-message' => __( 'Attach a CSV export of each new entry to the email.', 'formidable' ), |
| 33 |
'data-medium' => 'email-attachment-csv', |
| 34 |
'data-content' => 'attachment-csv', |
| 35 |
), |
| 36 |
array( |
| 37 |
'id' => 'frm_attach_pdf_' . $action_key, |
| 38 |
'label' => __( 'Attach PDF of entry to email', 'formidable' ), |
| 39 |
'data-upgrade' => __( 'Forms to PDF', 'formidable' ), |
| 40 |
'data-message' => __( 'Attach a PDF of each new entry to the email.', 'formidable' ), |
| 41 |
'data-medium' => 'email-attachment-pdf', |
| 42 |
'data-content' => 'attachment-pdf', |
| 43 |
), |
| 44 |
); |
| 45 |
|
| 46 |
$pdf_addon = FrmAddonsController::install_link( 'pdfs' ); |
| 47 |
$pdf_plan = FrmFormsHelper::get_plan_required( $pdf_addon ); |
| 48 |
|
| 49 |
if ( $pdf_plan ) { |
| 50 |
$toggle_upsells[1]['data-requires'] = $pdf_plan; |
| 51 |
} |
| 52 |
?> |
| 53 |
<!-- Start: Email attachment upsell --> |
| 54 |
<div class="frm_email_row"> |
| 55 |
<h3> |
| 56 |
<?php esc_html_e( 'Attachment', 'formidable' ); ?> |
| 57 |
</h3> |
| 58 |
|
| 59 |
<p class="frm-mb-md"> |
| 60 |
<a href="javascript:void(0)"<?php FrmAppHelper::array_to_html_params( $file_params, true ); ?>> |
| 61 |
<?php esc_html_e( 'Add Attachment', 'formidable' ); ?> |
| 62 |
</a> |
| 63 |
</p> |
| 64 |
|
| 65 |
<?php |
| 66 |
foreach ( $toggle_upsells as $upsell ) { |
| 67 |
$toggle_id = $upsell['id']; |
| 68 |
$toggle_params = $upsell; |
| 69 |
unset( $toggle_params['id'], $toggle_params['label'] ); |
| 70 |
$toggle_params['class'] = 'frm-h-stack-xs frm-mb-md frm_show_upgrade'; |
| 71 |
?> |
| 72 |
<div <?php FrmAppHelper::array_to_html_params( $toggle_params, true ); ?>> |
| 73 |
<?php |
| 74 |
FrmHtmlHelper::toggle( |
| 75 |
$toggle_id, |
| 76 |
$toggle_id, |
| 77 |
array( |
| 78 |
'div_class' => 'with_frm_style frm_toggle', |
| 79 |
'checked' => false, |
| 80 |
'echo' => true, |
| 81 |
'disabled' => true, |
| 82 |
) |
| 83 |
); |
| 84 |
?> |
| 85 |
<label id="<?php echo esc_attr( $toggle_id ); ?>_label" for="<?php echo esc_attr( $toggle_id ); ?>" class="frm_noallow"> |
| 86 |
<?php echo esc_html( $upsell['label'] ); ?> |
| 87 |
</label> |
| 88 |
</div> |
| 89 |
<?php |
| 90 |
}//end foreach |
| 91 |
?> |
| 92 |
</div> |
| 93 |
<!-- End: Email attachment upsell --> |
| 94 |
|