elementor / elementor

The most advanced frontend drag & drop page builder. Create high-end, pixel perfect websites at record speeds. Any theme, any page, any design.
https://elementor.com/
GNU General Public License v3.0
6.49k stars 1.4k forks source link

🐞 Custom Widget: Unable to select media in repeater block #21498

Open umair-arshad opened 1 year ago

umair-arshad commented 1 year ago

Prerequisites

Description

I have created a custom widget for my wordpress website but after recent updates I am not able to select media inside repeater bloks. in main widget they are working fine but in repeater blocks I am not able to select media. This issue is in new update. If i roll back to older version it works perfect.

Steps to reproduce

Add Custom widget on page add new block click the placeholder to select media (image, video, svg) and select. It will not select image and will show blank. besides this it will show a delete button but no media will be on display or on page.

Isolating the problem

System Info

System Info ````txt == Server Environment == Operating System: WINNT Software: Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.2.0 MySQL version: mariadb.org binary distribution v10.4.27 PHP Version: 8.2.0 PHP Max Input Vars: 1000 PHP Max Post Size: 40M GD Installed: Yes ZIP Installed: No Write Permissions: All right Elementor Library: Connected == WordPress Environment == Version: 6.1.1 Site URL: http://localhost/ibt Home URL: http://localhost/ibt WP Multisite: No Max Upload Size: 40 MB Memory limit: 512M Permalink Structure: /%postname%/ Language: en-US Timezone: 0 Admin Email: godspoweroboido@gmail.com Debug Mode: Inactive == Theme == Name: IBT Learning Version: 1.6 Author: Fluent Digital Child Theme: No == User == Role: administrator WP Profile lang: en_US User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 == Active Plugins == Akismet Anti-Spam Version: 5.0.2 Author: Automattic All-in-One WP Migration Version: 7.71 Author: ServMask All-in-One WP Migration File Extension Version: 1.8 Author: ServMask, Inc. Contact Form 7 Version: 5.7.4 Author: Takayuki Miyoshi Elementor Version: 3.5.5 Author: Elementor.com Elementor List Widget Version: 1.0.0 Author: Elementor Developer Elementor Pro Version: 3.10.3 Author: Elementor.com GTM4WP Version: 1.16.2 Author: Thomas Geiger LearnPress Version: 4.2.2 Author: ThimPress Options Framework Version: 1.8.5 Author: Devin Price SVG Support Version: 2.5.5 Author: Benbodhi W3 Total Cache Version: 2.3.0 Author: BoldGrid WPCode Lite Version: 2.0.8.1 Author: WPCode Yoast SEO Version: 20.2 Author: Team Yoast == Elements Usage == page : 1 wp-post : 2 Outcomes Section : 1 button : 1 heading : 3 image : 3 spacer : 1 text-editor : 5 wp-page : 21 Outcomes Section : 1 button : 9 divider : 1 google_maps : 1 heading : 85 image : 46 spacer : 3 text-editor : 43 == Elementor Experiments == Optimized DOM Output: Active by default Improved Asset Loading: Active by default Improved CSS Loading: Active by default Inline Font Icons: Inactive by default Accessibility Improvements: Active by default Import Export Template Kit: Active by default Additional Custom Breakpoints: Active by default Hide native WordPress widgets from search results: Active by default Landing Pages: Active by default Color Sampler: Active by default Favorite Widgets: Active by default Admin Top Bar: Active by default == Log == JS: showing 11 of 11JS: 2022-11-21 23:07:25 [error X 612][https://www.ibtlearning.co/wp-content/plugins/elementor/assets/js/editor-modules.min.js?ver=3.8.1:2:15625] Cannot read properties of undefined (reading \'global\') JS: 2022-12-31 16:47:45 [error X 2][https://www.ibtlearning.co/wp-includes/js/jquery/jquery.min.js?ver=3.6.1:2:51824] Cannot read properties of undefined (reading \'replace\') JS: 2023-01-03 17:43:53 [error X 1][https://www.ibtlearning.co/wp-content/plugins/elementor/assets/js/editor.min.js?ver=3.9.2:3:775248] Cannot read properties of undefined (reading \'toLowerCase\') JS: 2023-02-01 15:56:21 [error X 748][https://www.ibtlearning.co/wp-content/plugins/elementor/assets/js/editor-modules.min.js?ver=3.10.1:2:16011] Cannot read properties of undefined (reading 'global') JS: 2023-02-02 01:17:20 [error X 3][https://www.ibtlearning.co/wp-includes/js/jquery/jquery.min.js?ver=3.6.1:2:51824] Cannot read properties of undefined (reading 'replace') JS: 2023-02-02 14:11:12 [error X 2][http://localhost/ibt/wp-content/plugins/elementor/assets/js/frontend-modules.min.js?ver=3.10.2:2:7813] Cannot read properties of undefined (reading 'model') JS: 2023-02-02 20:15:24 [error X 86][http://localhost/ibt/wp-admin/js/editor.min.js?ver=6.1.1:2:734] Cannot read properties of undefined (reading 'style') JS: 2023-02-08 17:52:58 [error X 1][http://localhost/ibt/wp-content/plugins/elementor/assets/js/editor-modules.min.js?ver=3.10.2:2:14150] An invalid argument supplied as multiple control value [array ( 'category' => 'InvalidElementData', 'tag' => 'Element `Course Hero2` got as `btn_url` value. Expected array or object.', )] JS: 2023-02-08 17:52:58 [error X 1][http://localhost/ibt/wp-content/plugins/elementor/assets/js/editor-modules.min.js?ver=3.10.2:2:14150] An invalid argument supplied as multiple control value [array ( 'category' => 'InvalidElementData', 'tag' => 'Element `Course Hero2` got as `banner_btn_url` value. Expected array or object.', )] JS: 2023-02-08 20:01:58 [error X 13][http://localhost/ibt/wp-content/plugins/elementor/assets/js/editor.min.js?ver=3.10.2:3:560099] Element type not found: 'Course Hero2' JS: 2023-03-01 14:53:31 [error X 24][http://localhost/ibt/wp-content/plugins/elementor/assets/js/editor.min.js?ver=3.11.2:3:284575] Cannot read properties of undefined (reading 'size') Log: showing 20 of 252023-01-26 23:08:33 [info] elementor::elementor_updater Started 2023-01-26 23:08:33 [info] Elementor/Upgrades - _on_each_version Start 2023-01-26 23:08:33 [info] Elementor data updater process has been queued. [array ( 'plugin' => 'Elementor', 'from' => '3.9.2', 'to' => '3.10.1', )] 2023-01-26 23:08:34 [info] Elementor/Upgrades - _on_each_version Finished 2023-01-26 23:08:34 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '3.9.2', 'to' => '3.10.1', )] 2023-02-02 08:25:04 [info] Elementor data updater process has been queued. [array ( 'plugin' => 'Elementor', 'from' => '3.10.1', 'to' => '3.10.2', )] 2023-02-02 08:25:05 [info] elementor-pro::elementor_pro_updater Started 2023-02-02 08:25:05 [info] Elementor Pro/Upgrades - _on_each_version Start 2023-02-02 08:25:05 [info] Elementor Pro/Upgrades - _on_each_version Finished 2023-02-02 08:25:05 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '3.7.2', 'to' => '3.10.3', )] 2023-02-02 08:25:05 [info] Elementor data updater process has been queued. [array ( 'plugin' => 'Elementor Pro', 'from' => '3.7.2', 'to' => '3.10.3', )] 2023-02-02 08:25:05 [info] elementor::elementor_updater Started 2023-02-02 08:25:05 [info] Elementor/Upgrades - _on_each_version Start 2023-02-02 08:25:05 [info] Elementor/Upgrades - _on_each_version Finished 2023-02-02 08:25:05 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '3.10.1', 'to' => '3.10.2', )] 2023-02-02 08:25:06 [info] Elementor data updater process has been queued. [array ( 'plugin' => 'Elementor', 'from' => '3.10.1', 'to' => '3.10.2', )] 2023-03-01 15:01:07 [info] elementor::elementor_updater Started 2023-03-01 15:01:07 [info] Elementor/Upgrades - _on_each_version Start 2023-03-01 15:01:08 [info] Elementor/Upgrades - _on_each_version Finished 2023-03-01 15:01:08 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '3.10.2', 'to' => '3.11.2', )] PHP: showing 6 of 6PHP: 2023-02-02 12:34:59 [notice X 161][D:\xampp\htdocs\ibt\wp-content\plugins\elementor-pro\core\database\model-base.php::135] Return type of ElementorPro\Core\Database\Model_Base::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice [array ( 'trace' => ' #0: D:\xampp\htdocs\ibt\wp-content\plugins\elementor-pro\core\database\model-base.php(10): Elementor\Core\Logger\Manager -> rest_error_handler() #1: D:\xampp\htdocs\ibt\wp-content\plugins\elementor-pro\plugin.php(159): class type include()array ( 0 => 'D:\\xampp\\htdocs\\ibt\\wp-content\\plugins\\elementor-pro\\core\\database\\model-base.php', ) #2: D:\xampp\htdocs\ibt\wp-content\plugins\elementor-pro\modules\notes\database\models\note.php(18): ElementorPro\Plugin -> autoload() #3: D:\xampp\htdocs\ibt\wp-content\plugins\elementor-pro\plugin.php(159): class type include()array ( 0 => 'D:\\xampp\\htdocs\\ibt\\wp-content\\plugins\\elementor-pro\\modules\\notes\\database\\models\\note.php', ) #4: D:\xampp\htdocs\ibt\wp-content\plugins\elementor-pro\modules\notes\data\controller.php(243): ElementorPro\Plugin -> autoload() ', )] PHP: 2023-02-02 13:33:26 [notice X 96][D:\xampp\htdocs\ibt\wp-content\plugins\elementor-pro\core\utils\collection.php::75] Return type of ElementorPro\Core\Utils\Collection::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice [array ( 'trace' => ' #0: Elementor\Core\Logger\Manager -> shutdown() ', )] PHP: 2023-02-02 15:31:07 [error X 1][D:\xampp\htdocs\ibt\wp-content\plugins\elementor-pro\modules\role-manager\module.php::9] Maximum execution time of 120 seconds exceeded [array ( 'trace' => ' #0: Elementor\Core\Logger\Manager -> shutdown() ', )] PHP: 2023-02-22 12:39:16 [error X 1][D:\xampp\htdocs\ibt\wp-content\plugins\elementor\core\schemes\typography.php::65] Out of memory (allocated 46137344 bytes) (tried to allocate 20480 bytes) [array ( 'trace' => ' #0: Elementor\Core\Logger\Manager -> shutdown() ', )] PHP: 2023-03-01 15:34:23 [notice X 5][D:\xampp\htdocs\ibt\wp-content\plugins\elementor\data\v2\manager.php::281] Using ${expr} (variable variables) in strings is deprecated, use {${expr}} instead [array ( 'trace' => ' #0: Elementor\Core\Logger\Manager -> shutdown() ', )] PHP: 2023-03-01 15:35:39 [notice X 3][D:\xampp\htdocs\ibt\wp-content\plugins\elementor\core\upgrade\manager.php::62] version_compare(): Passing null to parameter #2 ($version2) of type string is deprecated [array ( 'trace' => ' #0: Elementor\Core\Logger\Manager -> shutdown() ', )] == Elementor - Compatibility Tag == Elementor List Widget: Compatibility not specified Elementor Pro: Compatibility not specified ````
nicholaszein commented 1 year ago

Hey @umair-arshad,

Thank you for submitting your report! πŸ™

❌ While reviewing your report, we noticed it was missing some key pieces of information:

In addition to the steps above, please provide the following information:

  1. The entirety of the code snippet you used to create the custom widget.
  2. A screen recording of the issue you're experiencing.

We need more information to understand and reproduce exactly what you're experiencing.

Please provide the requested information so we can help you better.

Thanks

umair-arshad commented 1 year ago

https://www.loom.com/share/b107903b7b4e43de880b64ee38590c22

<?php
if ( !defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

class OutcomesSection extends \Elementor\Widget_Base {

    public function get_name() {
        return 'Outcomes Section';
    }

    public function get_title() {
        return 'Outcomes section';
    }

    public function get_categories() {
        return [ 'theme-category' ];
    }

    public function get_keywords() {
        return [ 'Outcome', 'thumbs', 'gallery'];
    }

    protected function register_controls() {

        $this->start_controls_section(
            'content_section',
            [
                'label' => 'List Content',
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'title',
            [
                'label' => 'Title',
                'type' => \Elementor\Controls_Manager::TEXT,
                'label_block' => true
            ]
        );

        $this->add_control(
            'text_blocks',
            [
                'label' => 'Text Blocks',
                'type' => \Elementor\Controls_Manager::REPEATER,
                'label_block' => true,
                'fields' => [
                    [
                        'name' => 'title',
                        'label' => 'Title',
                        'type' => \Elementor\Controls_Manager::TEXT,
                    ],
                    [
                        'name' => 'copy',
                        'label' => 'Copy',
                        'type' => \Elementor\Controls_Manager::TEXTAREA,
                    ]
                ]
            ]
        );

        $this->add_control(
            'tabs',
            [
                'label' => 'Tabs Blocks',
                'label_block' => 'Block',
                'type' => \Elementor\Controls_Manager::REPEATER,
                'prevent_empty' => false,
                'fields' => [
                    [
                        'name' => 'name',
                        'label' => 'Name',
                        'type' => \Elementor\Controls_Manager::TEXT,
                    ],
                    [
                        'name' => 'jpb',
                        'label' => 'Job',
                        'type' => \Elementor\Controls_Manager::TEXT,
                    ],
                    [
                        'name' => 'oc_student',
                        'label' => 'Student',
                        'type' => \Elementor\Controls_Manager::MEDIA
                    ],
                    [
                        'name' => 'oc_company',
                        'label' => 'Company',
                        'type' => \Elementor\Controls_Manager::MEDIA
                    ],
                    [
                        'name' => 'oc_image',
                        'label' => 'Large',
                        'type' => \Elementor\Controls_Manager::MEDIA
                    ]
                ]
            ]
        );

        $this->end_controls_section();
    }

    protected function render() {
        $settings = $this->get_settings_for_display();
        ?>
        <div class="container-fluid outcome_look">
            <div class="container">
                <div class="row">
                    <div class="col-md-12">
                        <div class="heading">
                            <h4><?php echo $settings['title']; ?></h4>
                            <ul>
                                <?php foreach($settings['text_blocks'] as $block): ?>
                                <li><span><?php echo $block['title']; ?></span><p><?php echo $block['copy']; ?></p></li>
                                <?php endforeach; ?>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-7">
                        <div class="tab-content" id="myTabContent">
                            <?php $blockid = 0; foreach($settings['tabs'] as $blockd): $blockid++; ?>
                            <div class="tab-pane fade <?php echo ($blockid == 1) ? "show active":""; ?>" id="oc-block-<?php echo $blockid; ?>" role="tabpanel" aria-labelledby="home-tab">
                            <?php if(!empty($blockd['oc_image']['url'])): ?>
                                <div class="image">
                                    <img src="<?php echo $blockd['oc_image']['url']; ?>" alt="<?php echo $blockd['oc_image']['alt']; ?>"/> 
                                </div>
                            <?php endif; ?>
                            </div>
                            <?php endforeach; ?>
                        </div>
                    </div>
                    <div class="col-md-5">
                        <div class="recent_jobs">
                            <h4>Recent job placements</h4>
                            <ul class="nav nav-tabs" id="myTab" role="tablist">
                                <?php $blockid = 0; foreach($settings['tabs'] as $blocke): $blockid++; ?>
                                <li class="nav-item" role="presentation">
                                    <button class="nav-link <?php echo ($blockid == 1) ? "active":""; ?>" id="oc-block-<?php echo $blockid; ?>-tab" data-bs-toggle="tab" data-bs-target="#oc-block-<?php echo $blockid; ?>" type="button" role="tab" aria-controls="home" aria-selected="true">
                                        <div class="tsr-01">
                                            <?php if(!empty($blocke['oc_student']['url'])): ?>
                                            <div class="img">
                                                <img src="<?php echo $blocke['oc_student']['url']; ?>" alt="<?php echo $blocke['oc_student']['alt']; ?>"/> 
                                            </div>
                                            <?php endif; ?>
                                            <div class="content">
                                                <h5><?php echo $blocke['name']; ?></h5>
                                                <span><?php echo $blocke['job']; ?></span>
                                            </div>
                                            <?php if(!empty($blocke['oc_company']['url'])): ?>
                                            <div class="img">
                                                <img src="<?php echo $blocke['oc_company']['url']; ?>" alt="<?php echo $blocke['oc_company']['alt']; ?>" style="object-fit: contain;" /> 
                                            </div>
                                            <?php endif; ?>
                                        </div>
                                    </button>
                                </li>
                                <?php endforeach; ?>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php
    }
}
rami-elementor commented 1 year ago

Hi @umair-arshad

According to the attached "System Info", you are using Elementor 3.5.5 and Elementor Pro 3.10.3. Upgrade both plugins to the latest Elementor versions, it should fix the issue.

In addition, when testing addons, you need to test them in development environment. Use clean WordPress installation. Use the latest Elementor versions. Use Hello theme. And disable all the plugins / Elementor addons.

umair-arshad commented 1 year ago

I have tried but it's not working

On Thu, Mar 2, 2023 at 12:34β€―AM Rami Yushuvaev @.***> wrote:

Hi @umair-arshad https://github.com/umair-arshad

According to the attached "System Info", you are using Elementor 3.5.5 and Elementor Pro 3.10.3. Upgrade both plugins to the latest Elementor versions, it should fix the issue.

In addition, when testing addons, you need to test them in development environment. Use clean WordPress installation. Use the latest Elementor versions. Use Hello theme. And disable all the plugins / Elementor addons.

β€” Reply to this email directly, view it on GitHub https://github.com/elementor/elementor/issues/21498#issuecomment-1450739821, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTBJKLUQEZFU322HZP7AX3WZ6QCVANCNFSM6AAAAAAVMGWQD4 . You are receiving this because you were mentioned.Message ID: @.***>

--

Umair Arshad +92 (321) 435 8085 <+923214358085> Whatsapp : +92 (321) 435 8085 https://api.whatsapp.com/send?phone=+923214358085 Skype: Umair Arshad

umair-arshad commented 1 year ago

@rami-elementor I have tried all but didn't work. This old version works but not the latest

rami-elementor commented 1 year ago

@umair-arshad what errors do you get? can you enable the WordPress debug and attach the it here?

Larin13 commented 1 year ago

I have the same problem. I can't select media on the repeater. image

umair-arshad commented 1 year ago

@rami-elementor issues is til there in 5 website using elementor. Can you get it fixed

andreigusan commented 1 year ago

Same issue here.

silaswint commented 5 months ago

Same issue here, please fix it!

neatdisorder commented 2 months ago

Same issue here after updating to Elementor 3.21.3 and Elementor Pro 3.21.1. My workaround was to replace the media field with a gallery field.

mabezdek commented 2 months ago

Some issue.

dariodp89 commented 2 months ago

I have the same issue #27203 and I opened a PR #27239 but looks like nobody is checking it.

SheydaTeam commented 1 month ago

Same issue on the 8 website. :(

dariodp89 commented 1 month ago

Please can somebody check this PR? It should fix this bug... it's pretty urgent for a lot of people... https://github.com/elementor/elementor/pull/27239