| 1 |
<?php |
| 2 |
/** |
| 3 |
* Add-Ons addon view. |
| 4 |
* |
| 5 |
* @package Formidable |
| 6 |
* |
| 7 |
* @var array $addon Single add-on data (slug, title, display_name, excerpt, status, docs, docs_label, is_new, etc.). |
| 8 |
* @var string $license_type Current license type or empty string. |
| 9 |
* @var string $pricing Upgrade URL used for CTAs. |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
die( 'You are not allowed to call this page directly.' ); |
| 14 |
} |
| 15 |
|
| 16 |
if ( ! is_array( $addon ) || $addon['slug'] === 'views' ) { |
| 17 |
return; |
| 18 |
} |
| 19 |
|
| 20 |
?> |
| 21 |
<li <?php FrmAddonsHelper::add_addon_attributes( $addon ); ?>> |
| 22 |
<div class="frm-flex frm-gap-xs frm-items-center frm-mb-2xs"> |
| 23 |
<span class="frm-border-icon"> |
| 24 |
<?php FrmAddonsHelper::get_addon_icon( $addon['slug'] ); ?> |
| 25 |
</span> |
| 26 |
|
| 27 |
<h3> |
| 28 |
<span class="frm-font-medium frm-truncate"><?php echo esc_html( ! empty( $addon['display_name'] ) ? $addon['display_name'] : $addon['title'] ); ?></span> |
| 29 |
<?php |
| 30 |
if ( ! empty( $addon['is_new'] ) ) { |
| 31 |
FrmAppHelper::show_pill_text(); |
| 32 |
} |
| 33 |
?> |
| 34 |
</h3> |
| 35 |
|
| 36 |
<?php |
| 37 |
if ( FrmAddonsHelper::is_locked() ) { |
| 38 |
?> |
| 39 |
<span class="frm-card-lock-icon frm-ml-auto"> |
| 40 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon', array( 'aria-label' => __( 'Lock icon', 'formidable' ) ) ); ?> |
| 41 |
</span> |
| 42 |
<?php |
| 43 |
} else { |
| 44 |
FrmAddonsController::show_conditional_action_button( |
| 45 |
array( |
| 46 |
'addon' => $addon, |
| 47 |
'license_type' => ! empty( $license_type ) ? $license_type : false, |
| 48 |
'plan_required' => 'plan_required', |
| 49 |
'upgrade_link' => $pricing, |
| 50 |
) |
| 51 |
); |
| 52 |
FrmHtmlHelper::toggle( |
| 53 |
'frm-' . $addon['slug'], |
| 54 |
'frm-' . $addon['slug'], |
| 55 |
array( |
| 56 |
'div_class' => 'with_frm_style frm_toggle frm-ml-auto', |
| 57 |
'checked' => $addon['status']['type'] === 'active', |
| 58 |
'disabled' => $addon['slug'] === 'formidable-pro', |
| 59 |
'echo' => true, |
| 60 |
'aria-label-attr' => $addon['title'], |
| 61 |
) |
| 62 |
); |
| 63 |
}//end if |
| 64 |
?> |
| 65 |
</div> |
| 66 |
|
| 67 |
<p class="frm-line-clamp-2"> |
| 68 |
<?php FrmAppHelper::kses_echo( $addon['excerpt'], array( 'a' ) ); ?> |
| 69 |
</p> |
| 70 |
|
| 71 |
<span class="frm-page-skeleton-divider frm-mt-auto"></span> |
| 72 |
|
| 73 |
<div class="frm-flex frm-items-center frm-justify-between"> |
| 74 |
<?php |
| 75 |
if ( ! empty( $addon['docs'] ) && ! FrmAddonsHelper::get_plan() ) { |
| 76 |
$docs_label = ! empty( $addon['docs_label'] ) ? $addon['docs_label'] : __( 'View Docs', 'formidable' ); |
| 77 |
?> |
| 78 |
<a class="frm-link-with-external-icon" href="<?php echo esc_url( $addon['docs'] ); ?>" target="_blank" aria-label="<?php echo esc_attr( $docs_label ); ?>"> |
| 79 |
<?php echo esc_html( $docs_label ); ?> |
| 80 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowup8_icon' ); ?> |
| 81 |
</a> |
| 82 |
<?php |
| 83 |
} else { |
| 84 |
FrmFormsHelper::show_plan_required( FrmAddonsHelper::get_plan(), $pricing . '&utm_content=' . $addon['slug'] ); |
| 85 |
?> |
| 86 |
<div> |
| 87 |
<?php FrmAddonsController::addon_upgrade_link( $addon, $pricing ); ?> |
| 88 |
</div> |
| 89 |
<?php |
| 90 |
} |
| 91 |
?> |
| 92 |
</div> |
| 93 |
</li> |
| 94 |
|