Plugin Directory

Changeset 3397003


Ignore:
Timestamp:
11/17/2025 09:04:21 AM (3 months ago)
Author:
wpdino
Message:

Update to version 1.0.2 from GitHub

Location:
dinopack-for-elementor
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • dinopack-for-elementor/tags/1.0.2/CHANGELOG.md

    r3392084 r3397003  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
    66and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     7
     8## [1.0.2] - 2025-01-XX
     9
     10### Added
     11- Widget enable/disable feature in General settings tab
     12- "Widgets" subsection in General settings with individual checkboxes for each widget
     13- Subsection field type support in settings page renderer
     14- CSS Grid layout for widget checkboxes (3 columns on desktop, responsive on mobile/tablet)
     15- Widget filtering system that checks enabled status before registering widgets with Elementor
     16
     17### Changed
     18- Widget registration now respects enabled/disabled status from settings
     19- Settings page field rendering improved to support subsection grouping
     20- Widget checkboxes now display in a clean 3-column grid layout
     21
     22### Technical
     23- Modified `class-dinopack-settings-page.php` to add widget management functionality
     24- Updated `class-dinopack-elementor-widgets.php` to check widget enabled status before registration
     25- Enhanced `class-dinopack-field-renderer.php` to support subsection field type
     26- Added CSS grid styling in `admin.css` for responsive widget checkbox layout
     27- All widgets are enabled by default for backward compatibility
    728
    829## [1.0.1] - 2025-11-08
  • dinopack-for-elementor/tags/1.0.2/dinopack-for-elementor.php

    r3392084 r3397003  
    44 * Plugin URI:          https://wpdino.com/plugins/dinopack-for-elementor/
    55 * Description:         DinoPack for Elementor is a collection of creative and advanced widgets, expertly crafted by the WPDINO team to enhance your Elementor experience.
    6  * Version:             1.0.1
     6 * Version:             1.0.2
    77 * Author:              WPDINO
    88 * Author URI:          https://wpdino.com
  • dinopack-for-elementor/tags/1.0.2/inc/admin/assets/css/admin.css

    r3387271 r3397003  
    262262    font-size: 14px;
    263263    margin-top: 0px;
     264}
     265
     266.wpdino-subsection {
     267    margin-top: 40px;
     268    margin-bottom: 25px;
     269    padding-top: 25px;
     270    border-top: 1px solid #e5e5e5;
     271}
     272
     273.wpdino-subsection:first-child {
     274    margin-top: 0;
     275    padding-top: 0;
     276    border-top: none;
     277}
     278
     279.wpdino-subsection-title {
     280    font-size: 18px;
     281    font-weight: 600;
     282    color: #111;
     283    margin: 0 0 10px 0;
     284    padding-bottom: 8px;
     285    position: relative;
     286}
     287
     288.wpdino-subsection-title::after {
     289    content: '';
     290    position: absolute;
     291    bottom: 0;
     292    left: 0;
     293    width: 40px;
     294    height: 2px;
     295    background: #6F9C50;
     296}
     297
     298.wpdino-subsection-description {
     299    color: #666;
     300    margin-bottom: 20px;
     301    font-size: 14px;
     302    margin-top: 0px;
     303}
     304
     305/* Widgets grid layout */
     306.wpdino-widgets-subsection {
     307    margin-bottom: 0;
     308    padding-bottom: 20px;
     309}
     310
     311/* Grid wrapper for widget fields - 3 columns */
     312.wpdino-widgets-grid-wrapper {
     313    display: grid;
     314    grid-template-columns: repeat(3, 1fr);
     315    gap: 20px;
     316    margin-top: 0;
     317    margin-bottom: 25px;
     318}
     319
     320.wpdino-widgets-grid-wrapper .wpdino-field-group {
     321    margin-bottom: 0;
     322}
     323
     324/* Responsive adjustments for widgets grid */
     325@media (max-width: 1200px) {
     326    .wpdino-widgets-grid-wrapper {
     327        grid-template-columns: repeat(2, 1fr);
     328    }
     329}
     330
     331@media (max-width: 782px) {
     332    .wpdino-widgets-grid-wrapper {
     333        grid-template-columns: 1fr;
     334    }
    264335}
    265336
  • dinopack-for-elementor/tags/1.0.2/inc/admin/settings/class-dinopack-field-renderer.php

    r3387271 r3397003  
    3838        if ( isset( $field['type'] ) && $field['type'] === 'row' ) {
    3939            $this->render_row_field( $field, $option_name );
     40            return;
     41        }
     42
     43        // Handle subsection type (doesn't need value)
     44        if ( isset( $field['type'] ) && $field['type'] === 'subsection' ) {
     45            $this->render_subsection_field( $field );
    4046            return;
    4147        }
     
    142148            }
    143149            ?>
     150        </div>
     151        <?php
     152    }
     153
     154    /**
     155     * Render subsection field (displays a subsection title)
     156     *
     157     * @since 1.0.2
     158     * @param array $field Field configuration array
     159     */
     160    private function render_subsection_field( $field ) {
     161        $is_widgets_subsection = ( isset( $field['id'] ) && $field['id'] === 'widgets_subsection' );
     162        ?>
     163        <div class="wpdino-subsection<?php echo $is_widgets_subsection ? ' wpdino-widgets-subsection' : ''; ?>">
     164            <?php if ( ! empty( $field['label'] ) ) : ?>
     165            <h3 class="wpdino-subsection-title">
     166                <?php echo esc_html( $field['label'] ); ?>
     167            </h3>
     168            <?php endif; ?>
     169            <?php if ( ! empty( $field['description'] ) ) : ?>
     170            <p class="wpdino-subsection-description"><?php echo wp_kses_post( $field['description'] ); ?></p>
     171            <?php endif; ?>
    144172        </div>
    145173        <?php
     
    255283     */
    256284    private function render_checkbox_field( $field, $field_id, $field_name, $value, $field_class ) {
    257         ?>
    258         <div class="wpdino-field-group">
     285        // Check if this is a widget field
     286        $is_widget_field = ( strpos( $field_id, 'widget_enable_' ) === 0 );
     287        $field_group_class = $is_widget_field ? ' wpdino-widget-field' : '';
     288        ?>
     289        <div class="wpdino-field-group<?php echo esc_attr( $field_group_class ); ?>">
    259290            <label class="wpdino-checkbox">
    260291                <input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>"
  • dinopack-for-elementor/tags/1.0.2/inc/admin/settings/class-dinopack-settings-page.php

    r3387271 r3397003  
    146146            if ( ! empty( $section['fields'] ) ) {
    147147                foreach ( $section['fields'] as $field ) {
     148                    // Skip subsection fields (they don't have values)
     149                    if ( isset( $field['type'] ) && $field['type'] === 'subsection' ) {
     150                        continue;
     151                    }
     152                   
    148153                    // Handle row type (nested fields)
    149154                    if ( isset( $field['type'] ) && $field['type'] === 'row' && ! empty( $field['fields'] ) ) {
     
    238243        // Process each field dynamically
    239244        foreach ( $all_fields as $field_id => $field ) {
     245            // Skip subsection fields (they don't have values)
     246            if ( isset( $field['type'] ) && $field['type'] === 'subsection' ) {
     247                continue;
     248            }
     249           
    240250            $field_name = isset( $field['name'] ) ? $field['name'] : $field_id;
    241251            $default_value = isset( $field['default'] ) ? $field['default'] : '';
     
    427437            if ( ! empty( $section['fields'] ) ) {
    428438                foreach ( $section['fields'] as $field ) {
     439                    // Skip subsection fields (they don't have values)
     440                    if ( isset( $field['type'] ) && $field['type'] === 'subsection' ) {
     441                        continue;
     442                    }
     443                   
    429444                    // Handle row type (nested fields)
    430445                    if ( isset( $field['type'] ) && $field['type'] === 'row' && ! empty( $field['fields'] ) ) {
     
    597612
    598613    /**
     614     * Get available widgets list
     615     *
     616     * @since 1.0.2
     617     * @return array Array of widget slugs and their display names
     618     */
     619    private function get_available_widgets() {
     620        $widgets = array();
     621        $widgets_dir = DINOPACK_PATH . 'inc/elementor/widgets/';
     622       
     623        // Widget name mapping for better display names
     624        $widget_names = array(
     625            'advanced-heading' => esc_html__( 'Advanced Heading', 'dinopack-for-elementor' ),
     626            'blog' => esc_html__( 'Blog', 'dinopack-for-elementor' ),
     627            'button' => esc_html__( 'Button', 'dinopack-for-elementor' ),
     628            'car-specs' => esc_html__( 'Car Specs', 'dinopack-for-elementor' ),
     629            'gallery' => esc_html__( 'Gallery', 'dinopack-for-elementor' ),
     630            'icon-box' => esc_html__( 'Icon Box', 'dinopack-for-elementor' ),
     631            'newsletter' => esc_html__( 'Newsletter', 'dinopack-for-elementor' ),
     632            'popup' => esc_html__( 'Popup', 'dinopack-for-elementor' ),
     633            'price-table' => esc_html__( 'Price Table', 'dinopack-for-elementor' ),
     634            'progress-bar' => esc_html__( 'Progress Bar', 'dinopack-for-elementor' ),
     635            'restaurant-menu' => esc_html__( 'Restaurant Menu', 'dinopack-for-elementor' ),
     636            'woo-products' => esc_html__( 'WooCommerce Products', 'dinopack-for-elementor' ),
     637        );
     638       
     639        if ( ! is_dir( $widgets_dir ) ) {
     640            return $widgets;
     641        }
     642       
     643        foreach ( glob( $widgets_dir . '*', GLOB_ONLYDIR | GLOB_NOSORT ) as $path ) {
     644            $slug = basename( $path );
     645            $file = trailingslashit( $path ) . $slug . '.php';
     646           
     647            if ( file_exists( $file ) ) {
     648                // Use mapped name if available, otherwise convert slug to readable name
     649                if ( isset( $widget_names[ $slug ] ) ) {
     650                    $name = $widget_names[ $slug ];
     651                } else {
     652                    $name = str_replace( '-', ' ', $slug );
     653                    $name = ucwords( $name );
     654                }
     655                $widgets[ $slug ] = $name;
     656            }
     657        }
     658       
     659        // Sort widgets alphabetically by name
     660        asort( $widgets );
     661       
     662        return $widgets;
     663    }
     664
     665    /**
    599666     * Settings sections configuration
    600667     */
    601668    public function get_settings_sections() {
     669        $available_widgets = $this->get_available_widgets();
     670        $widget_fields = array();
     671       
     672        // Add widget checkboxes
     673        foreach ( $available_widgets as $widget_slug => $widget_name ) {
     674            $widget_fields[] = array(
     675                'type' => 'checkbox',
     676                'id'   => 'widget_enable_' . $widget_slug,
     677                'name' => 'widget_enable_' . $widget_slug,
     678                'label' => $widget_name,
     679                'description' => '',
     680                'default' => true, // All widgets enabled by default
     681            );
     682        }
     683       
     684        // Build fields array
     685        $general_fields = array(
     686            array(
     687                'type' => 'password',
     688                'id'   => 'dinopack_mailchimp_api_key',
     689                'name' => 'dinopack_mailchimp_api_key',
     690                'label' => esc_html__( 'MailChimp API Key', 'dinopack-for-elementor' ),
     691                /* translators: MailChimp API key description */
     692                'description' => sprintf( wp_kses_post( __( 'To use Newsletter widget enter your MailChimp API key. You can find it in your MailChimp account under <a target="_blank" href="%s">Account > Extras > API keys</a>.', 'dinopack-for-elementor' ) ), esc_url( 'https://mailchimp.com/help/about-api-keys/' ) ),
     693                'default' => '',
     694            ),
     695        );
     696       
     697        // Add widgets subsection
     698        if ( ! empty( $widget_fields ) ) {
     699            $general_fields[] = array(
     700                'type' => 'subsection',
     701                'id'   => 'widgets_subsection',
     702                'name' => 'widgets_subsection',
     703                'label' => esc_html__( 'Widgets', 'dinopack-for-elementor' ),
     704                'description' => esc_html__( 'Enable or disable widgets to show in the Elementor panel. All widgets are enabled by default.', 'dinopack-for-elementor' ),
     705            );
     706            $general_fields = array_merge( $general_fields, $widget_fields );
     707        }
     708       
    602709        return array(
    603710            'general' => array(
     
    607714                'callback'    => null,
    608715                'icon'        => 'dashicons-admin-generic',
    609                 'fields'      => array(
    610                     array(
    611                         'type' => 'password',
    612                         'id'   => 'dinopack_mailchimp_api_key',
    613                         'name' => 'dinopack_mailchimp_api_key',
    614                         'label' => esc_html__( 'MailChimp API Key', 'dinopack-for-elementor' ),
    615                         /* translators: MailChimp API key description */
    616                         'description' => sprintf( wp_kses_post( __( 'To use Newsletter widget enter your MailChimp API key. You can find it in your MailChimp account under <a target="_blank" href="%s">Account > Extras > API keys</a>.', 'dinopack-for-elementor' ) ), esc_url( 'https://mailchimp.com/help/about-api-keys/' ) ),
    617                         'default' => '',
    618                     ),
    619                 ),
     716                'fields'      => $general_fields,
    620717            ),
    621718            'tools' => array(
     
    863960                                <?php
    864961                                if ( ! empty( $section['fields'] ) ) {
     962                                    $in_widgets_section = false;
     963                                    $widget_fields_started = false;
     964                                   
    865965                                    foreach ( $section['fields'] as $field ) {
     966                                        // Check if we're entering the widgets subsection
     967                                        if ( isset( $field['type'] ) && $field['type'] === 'subsection' && isset( $field['id'] ) && $field['id'] === 'widgets_subsection' ) {
     968                                            $in_widgets_section = true;
     969                                        }
     970                                       
     971                                        // Check if this is a widget field
     972                                        $is_widget_field = ( isset( $field['id'] ) && strpos( $field['id'], 'widget_enable_' ) === 0 );
     973                                       
     974                                        // Open wrapper when first widget field is encountered
     975                                        if ( $in_widgets_section && $is_widget_field && ! $widget_fields_started ) {
     976                                            echo '<div class="wpdino-widgets-grid-wrapper">';
     977                                            $widget_fields_started = true;
     978                                        }
     979                                       
     980                                        // Close wrapper if we've left widget fields (next non-widget field after widgets)
     981                                        if ( $widget_fields_started && ! $is_widget_field && isset( $field['type'] ) && $field['type'] !== 'subsection' ) {
     982                                            echo '</div>';
     983                                            $widget_fields_started = false;
     984                                            $in_widgets_section = false;
     985                                        }
     986                                       
    866987                                        $this->render_field( $field );
     988                                    }
     989                                   
     990                                    // Close wrapper if still open at the end
     991                                    if ( $widget_fields_started ) {
     992                                        echo '</div>';
    867993                                    }
    868994                                }
  • dinopack-for-elementor/tags/1.0.2/inc/elementor/class-dinopack-elementor-widgets.php

    r3387271 r3397003  
    7272
    7373    /**
     74     * Check if widget is enabled
     75     *
     76     * @since 1.0.2
     77     * @access private
     78     * @param string $widget_slug Widget slug
     79     * @return bool
     80     */
     81    private function is_widget_enabled( $widget_slug ) {
     82        // Check if settings class exists
     83        if ( ! class_exists( '\DinoPack\DinoPack_Settings' ) ) {
     84            return true; // Default to enabled if settings not available
     85        }
     86       
     87        $settings = \DinoPack\DinoPack_Settings::instance();
     88        $setting_key = 'widget_enable_' . $widget_slug;
     89       
     90        // Get setting value (defaults to true if not set)
     91        $is_enabled = $settings->get_setting( $setting_key, true );
     92       
     93        return (bool) $is_enabled;
     94    }
     95
     96    /**
    7497     * Init Widgets
    7598     *
     
    84107        foreach ( glob( __DIR__ . '/widgets/*', GLOB_ONLYDIR | GLOB_NOSORT ) as $path ) {
    85108            $slug = str_replace( __DIR__ . '/widgets/', '', $path );
     109           
     110            // Check if widget is enabled
     111            if ( ! $this->is_widget_enabled( $slug ) ) {
     112                continue; // Skip disabled widgets
     113            }
     114           
    86115            $slug_ = str_replace( '-', '_', $slug );
    87116            $file = trailingslashit( $path ) . $slug . '.php';
  • dinopack-for-elementor/tags/1.0.2/readme.txt

    r3392084 r3397003  
    66Tested up to: 6.8
    77Requires PHP: 7.0
    8 Stable tag: 1.0.1
     8Stable tag: 1.0.2
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 A powerful collection of advanced Elementor widgets including WooCommerce products, Blog layouts, Newsletter with MailChimp, Restaurant Menu, Car Specs, and more.
     12A powerful collection of advanced Elementor widgets including WooCommerce products, Blog layouts, Newsletter with MailChimp and more.
    1313
    1414== Description ==
     
    110110== Changelog ==
    111111
     112= 1.0.2 =
     113* Added widget enable/disable feature in General settings tab
     114* Added "Widgets" subsection in settings with individual checkboxes for each widget
     115* Widget checkboxes now display in a clean 3-column grid layout (responsive)
     116* Widget registration now respects enabled/disabled status from settings
     117* All widgets are enabled by default for backward compatibility
     118
    112119= 1.0.1 =
    113120* Added Restaurant Menu Widget with global title, dietary badges, adaptive alignment, and icon-box styling
     
    135142
    136143== Upgrade Notice ==
     144
     145= 1.0.2 =
     146New widget management feature allows you to enable/disable individual widgets from the settings panel. All widgets remain enabled by default, so no action is required unless you want to hide specific widgets from the Elementor panel.
    137147
    138148= 1.0.0 =
  • dinopack-for-elementor/trunk/CHANGELOG.md

    r3392084 r3397003  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
    66and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     7
     8## [1.0.2] - 2025-01-XX
     9
     10### Added
     11- Widget enable/disable feature in General settings tab
     12- "Widgets" subsection in General settings with individual checkboxes for each widget
     13- Subsection field type support in settings page renderer
     14- CSS Grid layout for widget checkboxes (3 columns on desktop, responsive on mobile/tablet)
     15- Widget filtering system that checks enabled status before registering widgets with Elementor
     16
     17### Changed
     18- Widget registration now respects enabled/disabled status from settings
     19- Settings page field rendering improved to support subsection grouping
     20- Widget checkboxes now display in a clean 3-column grid layout
     21
     22### Technical
     23- Modified `class-dinopack-settings-page.php` to add widget management functionality
     24- Updated `class-dinopack-elementor-widgets.php` to check widget enabled status before registration
     25- Enhanced `class-dinopack-field-renderer.php` to support subsection field type
     26- Added CSS grid styling in `admin.css` for responsive widget checkbox layout
     27- All widgets are enabled by default for backward compatibility
    728
    829## [1.0.1] - 2025-11-08
  • dinopack-for-elementor/trunk/dinopack-for-elementor.php

    r3392084 r3397003  
    44 * Plugin URI:          https://wpdino.com/plugins/dinopack-for-elementor/
    55 * Description:         DinoPack for Elementor is a collection of creative and advanced widgets, expertly crafted by the WPDINO team to enhance your Elementor experience.
    6  * Version:             1.0.1
     6 * Version:             1.0.2
    77 * Author:              WPDINO
    88 * Author URI:          https://wpdino.com
  • dinopack-for-elementor/trunk/inc/admin/assets/css/admin.css

    r3387271 r3397003  
    262262    font-size: 14px;
    263263    margin-top: 0px;
     264}
     265
     266.wpdino-subsection {
     267    margin-top: 40px;
     268    margin-bottom: 25px;
     269    padding-top: 25px;
     270    border-top: 1px solid #e5e5e5;
     271}
     272
     273.wpdino-subsection:first-child {
     274    margin-top: 0;
     275    padding-top: 0;
     276    border-top: none;
     277}
     278
     279.wpdino-subsection-title {
     280    font-size: 18px;
     281    font-weight: 600;
     282    color: #111;
     283    margin: 0 0 10px 0;
     284    padding-bottom: 8px;
     285    position: relative;
     286}
     287
     288.wpdino-subsection-title::after {
     289    content: '';
     290    position: absolute;
     291    bottom: 0;
     292    left: 0;
     293    width: 40px;
     294    height: 2px;
     295    background: #6F9C50;
     296}
     297
     298.wpdino-subsection-description {
     299    color: #666;
     300    margin-bottom: 20px;
     301    font-size: 14px;
     302    margin-top: 0px;
     303}
     304
     305/* Widgets grid layout */
     306.wpdino-widgets-subsection {
     307    margin-bottom: 0;
     308    padding-bottom: 20px;
     309}
     310
     311/* Grid wrapper for widget fields - 3 columns */
     312.wpdino-widgets-grid-wrapper {
     313    display: grid;
     314    grid-template-columns: repeat(3, 1fr);
     315    gap: 20px;
     316    margin-top: 0;
     317    margin-bottom: 25px;
     318}
     319
     320.wpdino-widgets-grid-wrapper .wpdino-field-group {
     321    margin-bottom: 0;
     322}
     323
     324/* Responsive adjustments for widgets grid */
     325@media (max-width: 1200px) {
     326    .wpdino-widgets-grid-wrapper {
     327        grid-template-columns: repeat(2, 1fr);
     328    }
     329}
     330
     331@media (max-width: 782px) {
     332    .wpdino-widgets-grid-wrapper {
     333        grid-template-columns: 1fr;
     334    }
    264335}
    265336
  • dinopack-for-elementor/trunk/inc/admin/settings/class-dinopack-field-renderer.php

    r3387271 r3397003  
    3838        if ( isset( $field['type'] ) && $field['type'] === 'row' ) {
    3939            $this->render_row_field( $field, $option_name );
     40            return;
     41        }
     42
     43        // Handle subsection type (doesn't need value)
     44        if ( isset( $field['type'] ) && $field['type'] === 'subsection' ) {
     45            $this->render_subsection_field( $field );
    4046            return;
    4147        }
     
    142148            }
    143149            ?>
     150        </div>
     151        <?php
     152    }
     153
     154    /**
     155     * Render subsection field (displays a subsection title)
     156     *
     157     * @since 1.0.2
     158     * @param array $field Field configuration array
     159     */
     160    private function render_subsection_field( $field ) {
     161        $is_widgets_subsection = ( isset( $field['id'] ) && $field['id'] === 'widgets_subsection' );
     162        ?>
     163        <div class="wpdino-subsection<?php echo $is_widgets_subsection ? ' wpdino-widgets-subsection' : ''; ?>">
     164            <?php if ( ! empty( $field['label'] ) ) : ?>
     165            <h3 class="wpdino-subsection-title">
     166                <?php echo esc_html( $field['label'] ); ?>
     167            </h3>
     168            <?php endif; ?>
     169            <?php if ( ! empty( $field['description'] ) ) : ?>
     170            <p class="wpdino-subsection-description"><?php echo wp_kses_post( $field['description'] ); ?></p>
     171            <?php endif; ?>
    144172        </div>
    145173        <?php
     
    255283     */
    256284    private function render_checkbox_field( $field, $field_id, $field_name, $value, $field_class ) {
    257         ?>
    258         <div class="wpdino-field-group">
     285        // Check if this is a widget field
     286        $is_widget_field = ( strpos( $field_id, 'widget_enable_' ) === 0 );
     287        $field_group_class = $is_widget_field ? ' wpdino-widget-field' : '';
     288        ?>
     289        <div class="wpdino-field-group<?php echo esc_attr( $field_group_class ); ?>">
    259290            <label class="wpdino-checkbox">
    260291                <input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>"
  • dinopack-for-elementor/trunk/inc/admin/settings/class-dinopack-settings-page.php

    r3387271 r3397003  
    146146            if ( ! empty( $section['fields'] ) ) {
    147147                foreach ( $section['fields'] as $field ) {
     148                    // Skip subsection fields (they don't have values)
     149                    if ( isset( $field['type'] ) && $field['type'] === 'subsection' ) {
     150                        continue;
     151                    }
     152                   
    148153                    // Handle row type (nested fields)
    149154                    if ( isset( $field['type'] ) && $field['type'] === 'row' && ! empty( $field['fields'] ) ) {
     
    238243        // Process each field dynamically
    239244        foreach ( $all_fields as $field_id => $field ) {
     245            // Skip subsection fields (they don't have values)
     246            if ( isset( $field['type'] ) && $field['type'] === 'subsection' ) {
     247                continue;
     248            }
     249           
    240250            $field_name = isset( $field['name'] ) ? $field['name'] : $field_id;
    241251            $default_value = isset( $field['default'] ) ? $field['default'] : '';
     
    427437            if ( ! empty( $section['fields'] ) ) {
    428438                foreach ( $section['fields'] as $field ) {
     439                    // Skip subsection fields (they don't have values)
     440                    if ( isset( $field['type'] ) && $field['type'] === 'subsection' ) {
     441                        continue;
     442                    }
     443                   
    429444                    // Handle row type (nested fields)
    430445                    if ( isset( $field['type'] ) && $field['type'] === 'row' && ! empty( $field['fields'] ) ) {
     
    597612
    598613    /**
     614     * Get available widgets list
     615     *
     616     * @since 1.0.2
     617     * @return array Array of widget slugs and their display names
     618     */
     619    private function get_available_widgets() {
     620        $widgets = array();
     621        $widgets_dir = DINOPACK_PATH . 'inc/elementor/widgets/';
     622       
     623        // Widget name mapping for better display names
     624        $widget_names = array(
     625            'advanced-heading' => esc_html__( 'Advanced Heading', 'dinopack-for-elementor' ),
     626            'blog' => esc_html__( 'Blog', 'dinopack-for-elementor' ),
     627            'button' => esc_html__( 'Button', 'dinopack-for-elementor' ),
     628            'car-specs' => esc_html__( 'Car Specs', 'dinopack-for-elementor' ),
     629            'gallery' => esc_html__( 'Gallery', 'dinopack-for-elementor' ),
     630            'icon-box' => esc_html__( 'Icon Box', 'dinopack-for-elementor' ),
     631            'newsletter' => esc_html__( 'Newsletter', 'dinopack-for-elementor' ),
     632            'popup' => esc_html__( 'Popup', 'dinopack-for-elementor' ),
     633            'price-table' => esc_html__( 'Price Table', 'dinopack-for-elementor' ),
     634            'progress-bar' => esc_html__( 'Progress Bar', 'dinopack-for-elementor' ),
     635            'restaurant-menu' => esc_html__( 'Restaurant Menu', 'dinopack-for-elementor' ),
     636            'woo-products' => esc_html__( 'WooCommerce Products', 'dinopack-for-elementor' ),
     637        );
     638       
     639        if ( ! is_dir( $widgets_dir ) ) {
     640            return $widgets;
     641        }
     642       
     643        foreach ( glob( $widgets_dir . '*', GLOB_ONLYDIR | GLOB_NOSORT ) as $path ) {
     644            $slug = basename( $path );
     645            $file = trailingslashit( $path ) . $slug . '.php';
     646           
     647            if ( file_exists( $file ) ) {
     648                // Use mapped name if available, otherwise convert slug to readable name
     649                if ( isset( $widget_names[ $slug ] ) ) {
     650                    $name = $widget_names[ $slug ];
     651                } else {
     652                    $name = str_replace( '-', ' ', $slug );
     653                    $name = ucwords( $name );
     654                }
     655                $widgets[ $slug ] = $name;
     656            }
     657        }
     658       
     659        // Sort widgets alphabetically by name
     660        asort( $widgets );
     661       
     662        return $widgets;
     663    }
     664
     665    /**
    599666     * Settings sections configuration
    600667     */
    601668    public function get_settings_sections() {
     669        $available_widgets = $this->get_available_widgets();
     670        $widget_fields = array();
     671       
     672        // Add widget checkboxes
     673        foreach ( $available_widgets as $widget_slug => $widget_name ) {
     674            $widget_fields[] = array(
     675                'type' => 'checkbox',
     676                'id'   => 'widget_enable_' . $widget_slug,
     677                'name' => 'widget_enable_' . $widget_slug,
     678                'label' => $widget_name,
     679                'description' => '',
     680                'default' => true, // All widgets enabled by default
     681            );
     682        }
     683       
     684        // Build fields array
     685        $general_fields = array(
     686            array(
     687                'type' => 'password',
     688                'id'   => 'dinopack_mailchimp_api_key',
     689                'name' => 'dinopack_mailchimp_api_key',
     690                'label' => esc_html__( 'MailChimp API Key', 'dinopack-for-elementor' ),
     691                /* translators: MailChimp API key description */
     692                'description' => sprintf( wp_kses_post( __( 'To use Newsletter widget enter your MailChimp API key. You can find it in your MailChimp account under <a target="_blank" href="%s">Account > Extras > API keys</a>.', 'dinopack-for-elementor' ) ), esc_url( 'https://mailchimp.com/help/about-api-keys/' ) ),
     693                'default' => '',
     694            ),
     695        );
     696       
     697        // Add widgets subsection
     698        if ( ! empty( $widget_fields ) ) {
     699            $general_fields[] = array(
     700                'type' => 'subsection',
     701                'id'   => 'widgets_subsection',
     702                'name' => 'widgets_subsection',
     703                'label' => esc_html__( 'Widgets', 'dinopack-for-elementor' ),
     704                'description' => esc_html__( 'Enable or disable widgets to show in the Elementor panel. All widgets are enabled by default.', 'dinopack-for-elementor' ),
     705            );
     706            $general_fields = array_merge( $general_fields, $widget_fields );
     707        }
     708       
    602709        return array(
    603710            'general' => array(
     
    607714                'callback'    => null,
    608715                'icon'        => 'dashicons-admin-generic',
    609                 'fields'      => array(
    610                     array(
    611                         'type' => 'password',
    612                         'id'   => 'dinopack_mailchimp_api_key',
    613                         'name' => 'dinopack_mailchimp_api_key',
    614                         'label' => esc_html__( 'MailChimp API Key', 'dinopack-for-elementor' ),
    615                         /* translators: MailChimp API key description */
    616                         'description' => sprintf( wp_kses_post( __( 'To use Newsletter widget enter your MailChimp API key. You can find it in your MailChimp account under <a target="_blank" href="%s">Account > Extras > API keys</a>.', 'dinopack-for-elementor' ) ), esc_url( 'https://mailchimp.com/help/about-api-keys/' ) ),
    617                         'default' => '',
    618                     ),
    619                 ),
     716                'fields'      => $general_fields,
    620717            ),
    621718            'tools' => array(
     
    863960                                <?php
    864961                                if ( ! empty( $section['fields'] ) ) {
     962                                    $in_widgets_section = false;
     963                                    $widget_fields_started = false;
     964                                   
    865965                                    foreach ( $section['fields'] as $field ) {
     966                                        // Check if we're entering the widgets subsection
     967                                        if ( isset( $field['type'] ) && $field['type'] === 'subsection' && isset( $field['id'] ) && $field['id'] === 'widgets_subsection' ) {
     968                                            $in_widgets_section = true;
     969                                        }
     970                                       
     971                                        // Check if this is a widget field
     972                                        $is_widget_field = ( isset( $field['id'] ) && strpos( $field['id'], 'widget_enable_' ) === 0 );
     973                                       
     974                                        // Open wrapper when first widget field is encountered
     975                                        if ( $in_widgets_section && $is_widget_field && ! $widget_fields_started ) {
     976                                            echo '<div class="wpdino-widgets-grid-wrapper">';
     977                                            $widget_fields_started = true;
     978                                        }
     979                                       
     980                                        // Close wrapper if we've left widget fields (next non-widget field after widgets)
     981                                        if ( $widget_fields_started && ! $is_widget_field && isset( $field['type'] ) && $field['type'] !== 'subsection' ) {
     982                                            echo '</div>';
     983                                            $widget_fields_started = false;
     984                                            $in_widgets_section = false;
     985                                        }
     986                                       
    866987                                        $this->render_field( $field );
     988                                    }
     989                                   
     990                                    // Close wrapper if still open at the end
     991                                    if ( $widget_fields_started ) {
     992                                        echo '</div>';
    867993                                    }
    868994                                }
  • dinopack-for-elementor/trunk/inc/elementor/class-dinopack-elementor-widgets.php

    r3387271 r3397003  
    7272
    7373    /**
     74     * Check if widget is enabled
     75     *
     76     * @since 1.0.2
     77     * @access private
     78     * @param string $widget_slug Widget slug
     79     * @return bool
     80     */
     81    private function is_widget_enabled( $widget_slug ) {
     82        // Check if settings class exists
     83        if ( ! class_exists( '\DinoPack\DinoPack_Settings' ) ) {
     84            return true; // Default to enabled if settings not available
     85        }
     86       
     87        $settings = \DinoPack\DinoPack_Settings::instance();
     88        $setting_key = 'widget_enable_' . $widget_slug;
     89       
     90        // Get setting value (defaults to true if not set)
     91        $is_enabled = $settings->get_setting( $setting_key, true );
     92       
     93        return (bool) $is_enabled;
     94    }
     95
     96    /**
    7497     * Init Widgets
    7598     *
     
    84107        foreach ( glob( __DIR__ . '/widgets/*', GLOB_ONLYDIR | GLOB_NOSORT ) as $path ) {
    85108            $slug = str_replace( __DIR__ . '/widgets/', '', $path );
     109           
     110            // Check if widget is enabled
     111            if ( ! $this->is_widget_enabled( $slug ) ) {
     112                continue; // Skip disabled widgets
     113            }
     114           
    86115            $slug_ = str_replace( '-', '_', $slug );
    87116            $file = trailingslashit( $path ) . $slug . '.php';
  • dinopack-for-elementor/trunk/readme.txt

    r3392084 r3397003  
    66Tested up to: 6.8
    77Requires PHP: 7.0
    8 Stable tag: 1.0.1
     8Stable tag: 1.0.2
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 A powerful collection of advanced Elementor widgets including WooCommerce products, Blog layouts, Newsletter with MailChimp, Restaurant Menu, Car Specs, and more.
     12A powerful collection of advanced Elementor widgets including WooCommerce products, Blog layouts, Newsletter with MailChimp and more.
    1313
    1414== Description ==
     
    110110== Changelog ==
    111111
     112= 1.0.2 =
     113* Added widget enable/disable feature in General settings tab
     114* Added "Widgets" subsection in settings with individual checkboxes for each widget
     115* Widget checkboxes now display in a clean 3-column grid layout (responsive)
     116* Widget registration now respects enabled/disabled status from settings
     117* All widgets are enabled by default for backward compatibility
     118
    112119= 1.0.1 =
    113120* Added Restaurant Menu Widget with global title, dietary badges, adaptive alignment, and icon-box styling
     
    135142
    136143== Upgrade Notice ==
     144
     145= 1.0.2 =
     146New widget management feature allows you to enable/disable individual widgets from the settings panel. All widgets remain enabled by default, so no action is required unless you want to hide specific widgets from the Elementor panel.
    137147
    138148= 1.0.0 =
Note: See TracChangeset for help on using the changeset viewer.