| 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 |
|
| 17 |
$group_slug = str_replace(' ', '-', strtolower($group_name)); |
| 18 |
$group_enabled = get_option('easy_element_group_' . $group_slug, 0); |
| 19 |
?> |
| 20 |
<div class="easyel-widget-heading-group easyel-dflex easyel-justify-between easyel-align-center"> |
| 21 |
<h2 class="easyel-widget-group-title"><?php echo esc_html($group_name); ?></h2> |
| 22 |
<label class="easyel-toggle-switch-widget"> |
| 23 |
<input type="checkbox" |
| 24 |
class="easyel-group-toggle-widget" |
| 25 |
name ="easyel-toggle-switch-widget" |
| 26 |
data-group="<?php echo esc_attr($group_slug); ?>" |
| 27 |
<?php checked(1, $group_enabled); ?> /> |
| 28 |
<span class="easyel-enable-all-widget"><?php echo esc_html__("Enable All", "easy-elements");?></span> |
| 29 |
<span class="slider"></span> |
| 30 |
</label> |
| 31 |
<input type="hidden" name="easy_element_group_<?php echo esc_attr($group_slug); ?>" |
| 32 |
class="easyel-group-hidden" |
| 33 |
value="<?php echo esc_attr($group_enabled); ?>" /> |
| 34 |
</div> |
| 35 |
|
| 36 |
<div class="easyel-widgets-grid <?php echo esc_attr( $group_slug ); ?>" data-group="<?php echo esc_attr($group_slug); ?>"> |
| 37 |
<?php foreach ( $widgets as $key => $widget ) : |
| 38 |
$option_name = 'easy_element_' . $tab_slug . '_' . $key; |
| 39 |
$enabled = get_option($option_name, '1'); |
| 40 |
|
| 41 |
$is_pro_enable = isset($widget['is_pro']) && $widget['is_pro']; |
| 42 |
$is_pro = $is_pro_enable && ! class_exists('Easy_Elements_Pro'); |
| 43 |
$easyel_pro_attr_class = $is_pro ? ' easyel-pro-enable' : ''; |
| 44 |
$pro_widget = $is_pro_enable ? 'easyel-pro-widget' : ''; |
| 45 |
$is_upcoming_enable = isset( $widget['upcoming'] ) ? $widget['upcoming'] : ''; |
| 46 |
|
| 47 |
?> |
| 48 |
<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); ?>"> |
| 49 |
<div class="easyel-widget-card-content easyel-dflex easyel-align-center"> |
| 50 |
<div class="easyel-widget-icon"> |
| 51 |
<?php |
| 52 |
if( $is_upcoming_enable ) { ?> |
| 53 |
<div class="easyel-pro-badge"> |
| 54 |
<i class="easyelIcon-crown"></i> |
| 55 |
<?php esc_html_e( 'Upcoming', 'easy-elements' )?> |
| 56 |
</div> |
| 57 |
|
| 58 |
<?php } elseif( $is_pro_enable ) { ?> |
| 59 |
<div class="easyel-pro-badge"> |
| 60 |
<i class="easyelIcon-crown"></i> |
| 61 |
<?php esc_html_e( 'Pro', 'easy-elements' )?> |
| 62 |
</div> |
| 63 |
<?php } ?> |
| 64 |
<i class="<?php echo esc_attr($widget['icon']); ?>"></i> |
| 65 |
</div> |
| 66 |
<div class="easyel-widget-text"> |
| 67 |
<div class="widget-header"> |
| 68 |
<strong><?php echo esc_html($widget['title']); ?></strong> |
| 69 |
|
| 70 |
</div> |
| 71 |
<div class="easyel-demo-link easyel-dflex easyel-align-center"> |
| 72 |
<?php if ( ! empty( $widget['demo_url'] ) ) : ?> |
| 73 |
<a href="<?php echo esc_url($widget['demo_url']); ?>" target="_blank" rel="noopener noreferrer"> |
| 74 |
<i class="easyelIcon-monitor"></i> |
| 75 |
<?php esc_html_e('Demo', 'easy-elements'); ?> |
| 76 |
</a> |
| 77 |
<?php endif; ?> |
| 78 |
<?php if ( ! empty( $widget['docx_url'] ) ) : ?> |
| 79 |
<a href="<?php echo esc_url($widget['docx_url']); ?>" target="_blank" rel="noopener noreferrer"> |
| 80 |
<i class="easyelIcon-document"></i> |
| 81 |
<?php esc_html_e('Docs', 'easy-elements'); ?> |
| 82 |
</a> |
| 83 |
<?php endif; ?> |
| 84 |
</div> |
| 85 |
</div> |
| 86 |
</div> |
| 87 |
<div class="widget-toggle easyel-widget-card-switcher <?php echo esc_attr( $easyel_pro_attr_class ); ?>"> |
| 88 |
<label class="easy-toggle-switch"> |
| 89 |
<?php |
| 90 |
if ( ! empty( $widget['is_pro'] ) && ! class_exists('Easy_Elements_Pro') ) { ?> |
| 91 |
|
| 92 |
<input type="checkbox" |
| 93 |
class="widget-toggle-checkbox" |
| 94 |
data-widget-key="<?php echo esc_attr($key); ?>" |
| 95 |
data-tab="<?php echo esc_attr($tab_slug); ?>" |
| 96 |
value="1" |
| 97 |
name="easy-toggle-switch" |
| 98 |
disabled /> |
| 99 |
|
| 100 |
<?php } else { ?> |
| 101 |
|
| 102 |
<input type="checkbox" |
| 103 |
class="widget-toggle-checkbox" |
| 104 |
data-widget-key="<?php echo esc_attr($key); ?>" |
| 105 |
data-tab="<?php echo esc_attr($tab_slug); ?>" |
| 106 |
value="1" |
| 107 |
name="easy-toggle-switch" |
| 108 |
<?php checked( $enabled, '1' ); ?> |
| 109 |
<?php disabled( $is_pro ); ?> /> |
| 110 |
|
| 111 |
<?php } ?> |
| 112 |
|
| 113 |
<span class="slider"></span> |
| 114 |
</label> |
| 115 |
</div> |
| 116 |
</div> |
| 117 |
<?php endforeach; ?> |
| 118 |
</div> |
| 119 |
<?php endforeach; ?> |
| 120 |
</div> |