| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
|
| 4 |
$tab_slug = isset($current_tab) ? $current_tab : 'widget'; |
| 5 |
$grouped_widgets = []; |
| 6 |
|
| 7 |
// Group widgets |
| 8 |
foreach ( $available_elements as $key => $widget ) { |
| 9 |
$group = isset($widget['group']) ? $widget['group'] : 'General Widgets'; |
| 10 |
$grouped_widgets[$group][$key] = $widget; |
| 11 |
} |
| 12 |
?> |
| 13 |
|
| 14 |
<div class="easy-widgets-wrapper"> |
| 15 |
<?php foreach ( $grouped_widgets as $group_name => $widgets ) : |
| 16 |
$group_slug = str_replace(' ', '-', strtolower($group_name)); |
| 17 |
?> |
| 18 |
<h2 class="easyel-widget-group-title"><?php echo esc_html($group_name); ?></h2> |
| 19 |
<div class="easyel-widgets-grid <?php echo esc_attr( $group_slug ); ?>"> |
| 20 |
<?php foreach ( $widgets as $key => $widget ) : |
| 21 |
$option_name = 'easy_element_' . $tab_slug . '_' . $key; |
| 22 |
$enabled = get_option($option_name, '1'); |
| 23 |
|
| 24 |
$is_pro_enable = isset($widget['is_pro']) && $widget['is_pro']; |
| 25 |
$is_pro = $is_pro_enable && ! class_exists('Easy_Elements_Pro'); |
| 26 |
$easyel_pro_attr_class = $is_pro ? ' easyel-pro-enable' : ''; |
| 27 |
$pro_widget = $is_pro_enable ? 'easyel-pro-widget' : ''; |
| 28 |
?> |
| 29 |
<div class="easy-widget-item easyel-widget-card easyel-dflex easyel-justify-between easyel-align-center <?php echo esc_attr($easyel_pro_attr_class . ' ' . $pro_widget); ?>" data-widget-key="<?php echo esc_attr($key); ?>"> |
| 30 |
<div class="easyel-widget-card-content easyel-dflex easyel-align-center"> |
| 31 |
<div class="easyel-widget-icon"> |
| 32 |
<?php if( $is_pro_enable ) : ?> |
| 33 |
<div class="easyel-pro-badge"> |
| 34 |
<i class="easyelIcon-crown"></i> |
| 35 |
<?php esc_html_e( 'Pro', 'easy-elements' )?> |
| 36 |
</div> |
| 37 |
<?php endif; ?> |
| 38 |
<i class="<?php echo esc_attr($widget['icon']); ?>"></i> |
| 39 |
</div> |
| 40 |
<div class="easyel-widget-text"> |
| 41 |
<div class="widget-header"> |
| 42 |
<strong><?php echo esc_html($widget['title']); ?></strong> |
| 43 |
</div> |
| 44 |
<div class="easyel-demo-link easyel-dflex easyel-align-center"> |
| 45 |
<?php if ( ! empty( $widget['demo_url'] ) ) : ?> |
| 46 |
<a href="<?php echo esc_url($widget['demo_url']); ?>" target="_blank" rel="noopener noreferrer"> |
| 47 |
<i class="easyelIcon-monitor"></i> |
| 48 |
<?php esc_html_e('Demo', 'easy-elements'); ?> |
| 49 |
</a> |
| 50 |
<?php endif; ?> |
| 51 |
<?php if ( ! empty( $widget['docx_url'] ) ) : ?> |
| 52 |
<a href="<?php echo esc_url($widget['docx_url']); ?>" target="_blank" rel="noopener noreferrer"> |
| 53 |
<i class="easyelIcon-document"></i> |
| 54 |
<?php esc_html_e('Docs', 'easy-elements'); ?> |
| 55 |
</a> |
| 56 |
<?php endif; ?> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
</div> |
| 60 |
<div class="widget-toggle easyel-widget-card-switcher"> |
| 61 |
<label class="easy-toggle-switch"> |
| 62 |
<input type="checkbox" |
| 63 |
class="widget-toggle-checkbox" |
| 64 |
data-widget-key="<?php echo esc_attr($key); ?>" |
| 65 |
data-tab="<?php echo esc_attr($tab_slug); ?>" |
| 66 |
value="1" |
| 67 |
name="easy-toggle-switch" |
| 68 |
<?php checked( $enabled, '1' ); ?> |
| 69 |
<?php disabled( $is_pro ); ?> /> |
| 70 |
<span class="slider"></span> |
| 71 |
</label> |
| 72 |
</div> |
| 73 |
</div> |
| 74 |
<?php endforeach; ?> |
| 75 |
</div> |
| 76 |
<?php endforeach; ?> |
| 77 |
</div> |