| 1 |
<?php |
| 2 |
/** |
| 3 |
* Form Templates - Template. |
| 4 |
* |
| 5 |
* @package Formidable |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
die( 'You are not allowed to call this page directly.' ); |
| 10 |
} |
| 11 |
|
| 12 |
if ( ! is_array( $template ) ) { |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
if ( ! empty( $template['message'] ) ) { |
| 17 |
?> |
| 18 |
<li class="frm_error_style inline"> |
| 19 |
<?php |
| 20 |
FrmAppHelper::kses_echo( $template['message'], array( 'a', 'b', 'strong', 'br' ) ); |
| 21 |
?> |
| 22 |
</li> |
| 23 |
<?php |
| 24 |
return; |
| 25 |
} |
| 26 |
|
| 27 |
FrmFormTemplatesHelper::prepare_template_details( $template, $pricing, $license_type ); |
| 28 |
?> |
| 29 |
<li <?php FrmFormTemplatesHelper::add_template_attributes( $template, $expired ); ?>> |
| 30 |
<?php if ( $template['is_featured'] ) : ?> |
| 31 |
<div class="frm-form-templates-item-icon"> |
| 32 |
<?php FrmFormsHelper::template_icon( $template['categories'] ); ?> |
| 33 |
</div> |
| 34 |
<?php endif; ?> |
| 35 |
|
| 36 |
<div class="frm-form-templates-item-body"> |
| 37 |
<h3 class="frm-form-templates-item-title frm-font-medium"> |
| 38 |
<span class="frm-form-templates-item-title-text"> |
| 39 |
<?php if ( $template['plan_required'] ) { ?> |
| 40 |
<span class="frm-form-templates-item-lock-icon"> |
| 41 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon', array( 'aria-label' => __( 'Lock icon', 'formidable' ) ) ); ?> |
| 42 |
</span> |
| 43 |
<?php } ?> |
| 44 |
|
| 45 |
<span class="frm-form-template-name frm-truncate"> |
| 46 |
<?php echo esc_html( $template['name'] ); ?> |
| 47 |
</span> |
| 48 |
</span> |
| 49 |
|
| 50 |
<span class="frm-flex-box frm-gap-xs frm-items-center frm-ml-auto"> |
| 51 |
<?php |
| 52 |
if ( $template['is_custom'] ) { |
| 53 |
$trash_links = FrmFormsHelper::delete_trash_links( $template['id'] ); |
| 54 |
?> |
| 55 |
<a href="<?php echo esc_url( $trash_links['trash']['url'] ); ?>" class="frm-form-templates-custom-item-trash-button frm-flex-center frm-fadein" data-frmverify="<?php esc_attr_e( 'Do you want to move this form template to the trash?', 'formidable' ); ?>" data-frmverify-btn="frm-button-red" role="button" aria-label="<?php esc_attr_e( 'Move to the trash button', 'formidable' ); ?>"> |
| 56 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_delete_icon', array( 'aria-label' => __( 'Move to Trash', 'formidable' ) ) ); ?> |
| 57 |
</a> |
| 58 |
<span class="frm-vertical-line frm-fadein"></span> |
| 59 |
<?php } ?> |
| 60 |
|
| 61 |
<a href="#" class="frm-form-templates-item-favorite-button frm-fadein" role="button" aria-label="<?php esc_attr_e( 'Add to favorites', 'formidable' ); ?>"> |
| 62 |
<?php |
| 63 |
$favorite_button_icon = $template['is_favorite'] ? 'frm_heart_solid_icon' : 'frm_heart_icon'; |
| 64 |
FrmAppHelper::icon_by_class( 'frmfont ' . $favorite_button_icon ); |
| 65 |
?> |
| 66 |
</a> |
| 67 |
</span> |
| 68 |
</h3> |
| 69 |
|
| 70 |
<div class="frm-form-templates-item-content"> |
| 71 |
<div class="frm-form-templates-item-buttons frm-fadein-down-short"> |
| 72 |
<a <?php FrmFormTemplatesHelper::add_template_link_attributes( $template ); ?>> |
| 73 |
<?php echo $template['is_custom'] ? esc_html__( 'Edit', 'formidable' ) : esc_html__( 'View Demo', 'formidable' ); ?> |
| 74 |
</a> |
| 75 |
<a href="<?php echo esc_url( $template['use_template'] ); ?>" class="button button-primary frm-button-primary frm-small frm-form-templates-use-template-button" role="button"> |
| 76 |
<?php esc_html_e( 'Use Template', 'formidable' ); ?> |
| 77 |
</a> |
| 78 |
</div> |
| 79 |
|
| 80 |
<p class="frm-form-templates-item-description frm-line-clamp-2"> |
| 81 |
<?php |
| 82 |
if ( $template['description'] ) { |
| 83 |
FrmAppHelper::kses_echo( $template['description'], array( 'a', 'i', 'span', 'use', 'svg' ) ); |
| 84 |
} elseif ( $template['is_custom'] ) { |
| 85 |
echo '<i>'; |
| 86 |
printf( |
| 87 |
/* translators: %s: date */ |
| 88 |
esc_html__( 'Created %s', 'formidable' ), |
| 89 |
esc_html( date_i18n( get_option( 'date_format' ), strtotime( $template['created_at'] ) ) ) |
| 90 |
); |
| 91 |
echo '</i>'; |
| 92 |
} else { |
| 93 |
echo '<i>' . esc_html__( 'No description', 'formidable' ) . '</i>'; |
| 94 |
} |
| 95 |
?> |
| 96 |
</p> |
| 97 |
</div> |
| 98 |
</div> |
| 99 |
</li> |
| 100 |
|