Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⛔ 📚 🐞 Bug Report: Custom Widget does not work if methods are separated on different files #23248

Closed
5 tasks done
babakfp opened this issue Aug 1, 2023 · 1 comment
Closed
5 tasks done
Labels
compatibility/3rd-party Indicates a compatibility problem with a 3rd-party plugin or theme. component/code Indicates when a topic is related to a component’s code. mod* type/developer-api Indicates when a topic is related to the Developer API and Documentation.

Comments

@babakfp
Copy link

babakfp commented Aug 1, 2023

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest stable version of Elementor.

Description

Hello

Please watch this video:

Rec.0030.mp4

When you drag and drop the widget and preview the page, the error pops up. If you refresh, it goes away. It only happens once. The strange thing is, in the source code of the addon, if you directly place the source code of options.php, inside the register_controls function, the error doesn't pop up!

This issue only happens on version 3.15.0 and it works with no issues on version 3.14.1

Source code of the addon https://github.com/babakfp/elementor-addon-bug

Steps to reproduce

Above.

Isolating the problem

  • This bug happens with only Elementor plugin active (and Elementor Pro).
  • This bug happens with a Blank WordPress theme active (Hello theme).
  • I can reproduce this bug consistently following the steps above.

System Info

Click to reveal
					
== Server Environment ==
	Operating System: WINNT
	Software: Apache/2.4.54 (Win64) PHP/7.4.33 mod_fcgid/2.3.10-dev
	MySQL version: MySQL Community Server - GPL v8.0.31
	PHP Version: 7.4.33
	PHP Memory Limit: 128M
	PHP Max Input Vars: 2500
	PHP Max Post Size: 8M
	GD Installed: Yes
	ZIP Installed: Yes
	Write Permissions: All right
	Elementor Library: Connected

== WordPress Environment ==
	Version: 6.2.2
	Site URL: http://localhost/dev
	Home URL: http://localhost/dev
	WP Multisite: No
	Max Upload Size: 2 MB
	Memory limit: 40M
	Max Memory limit: 256M
	Permalink Structure: /%year%/%monthnum%/%day%/%postname%/
	Language: en-US
	Timezone: 0
	Debug Mode: Active

== Theme ==
	Name: Hello Elementor
	Version: 2.8.1
	Author: Elementor Team
	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/115.0.0.0 Safari/537.36

== Active Plugins ==
	Elementor
		Version: 3.15.0
		Author: Elementor.com

	Elementor Addon
		Version: 2.20.0
		Author: 


== Elementor Experiments ==
	Optimized DOM Output: Active by default
	Improved Asset Loading: Active by default
	Improved CSS Loading: Active by default
	Inline Font Icons: Active
	Additional Custom Breakpoints: Active by default
	admin_menu_rearrangement: Inactive by default
	Flexbox Container: Active
	Upgrade Swiper Library: Active by default
	Grid Container: Active
	Hello Theme Header & Footer: Active by default
	Editor Top Bar: Inactive by default
	Landing Pages: Active by default
	Nested Elements: Active
	Lazy Load Background Images: Inactive by default
	Global Style Guide: Inactive by default


== Log ==
	
JS: showing 2 of 2JS: 2023-05-19 19:32:36 [error X 1][http://localhost/dev/wp-content/plugins/elementor/assets/js/new-template.min.js?ver=3.13.2:2:2932] elementor_new_template_form_controls is not defined 
JS: 2023-05-22 20:34:40 [error X 1][http://localhost/dev/wp-content/plugins/elementor/assets/js/editor.min.js?ver=3.13.2:3:794943] Cannot read properties of undefined (reading 'toLowerCase') 

Log: showing 10 of 102023-05-23 09:52:10 [info] elementor::elementor_updater Started 
2023-05-23 09:52:10 [info] Elementor/Upgrades - _on_each_version Start  
2023-05-23 09:52:10 [info] Elementor/Upgrades - _on_each_version Finished 
2023-05-23 09:52:10 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor',
  'from' => '3.13.2',
  'to' => '3.13.3',
)]
2023-05-23 09:52:10 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor',
  'from' => '3.13.2',
  'to' => '3.13.3',
)]
2023-07-31 18:13:59 [info] elementor::elementor_updater Started 
2023-07-31 18:13:59 [info] Elementor/Upgrades - _on_each_version Start  
2023-07-31 18:13:59 [info] Elementor/Upgrades - _on_each_version Finished 
2023-07-31 18:13:59 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor',
  'from' => '3.13.3',
  'to' => '3.15.0',
)]
2023-07-31 18:13:59 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor',
  'from' => '3.13.3',
  'to' => '3.15.0',
)]

PHP: showing 10 of 10PHP: 2023-07-31 18:35:59 [warning X 3][C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\lib\jquery.php::207] Undefined array key "scroll_horizontal_in_vertical" [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2023-07-31 18:46:29 [error X 3][C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\lib\render.php::34] syntax error, unexpected identifier "movement_type", expecting "]" [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2023-07-31 18:55:23 [notice X 3][C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\lib\jquery.php::207] Undefined index: scroll_horizontal_in_vertical [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2023-08-01 05:45:17 [notice X 1][C:\Wampserver\www\dev\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-08-01 07:54:46 [notice X 20][C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\lib\render.php::7] Undefined index: transition_mode [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2023-08-01 08:14:05 [notice X 4][C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\lib\render.php::6] Undefined index: my_controller_name [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2023-08-01 08:31:48 [error X 1][C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\elementor-fullpage-scroll-pixerul.php::41] require_once(): Failed opening required 'C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul/widgets.php' (include_path='.;C:\php\pear') [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2023-08-01 08:37:21 [notice X 1][C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\lib\render.php::105] Undefined index: subheading_position [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2023-08-01 08:38:00 [error X 1][C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\fullpage-scroll.php::54] require_once(): Failed opening required 'C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\lib\content\general.php' (include_path='.;C:\php\pear') [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2023-08-01 08:51:22 [error X 1][C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\fullpage-scroll.php::23] Uncaught Error: Class 'Fullpage_Widget' not found in C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\widgets\fullpage-scroll.php:23
Stack trace:
#0 C:\Wampserver\www\dev\wp-content\plugins\elementor-fullpage-scroll-pixerul\includes\core.php(29): require_once()
#1 C:\Wampserver\www\dev\wp-includes\class-wp-hook.php(308): Elementor_Addon->init_widgets(Object(Elementor\Widgets_Manager))
#2 C:\Wampserver\www\dev\wp-includes\class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#3 C:\Wampserver\www\dev\wp-includes\plugin.php(517): WP_Hook->do_action(Array)
#4 C:\Wampserver\www\dev\wp-content\plugins\elementor\includes\managers\widgets.php(138): do_action('elementor/widge...', Object(Elementor\Widgets_Manager))
#5 C:\Wampserver\www\dev\wp-content\plugins\elementor\includes\managers\widgets.php(328): Elementor\Widgets_Manager->init_widgets()
#6 C:\Wampserver\www\dev\wp-content\plugins\elementor\modules\favorites\types\widgets.php(54): Elementor\Widgets_Manager->get_widget_types('full [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]



== Elementor - Compatibility Tag ==
	
	Elementor Addon: Compatibility not specified
				
@babakfp babakfp added the status/awaiting_triage Indicates when an Issue, Pull Request, or Discussion awaits to be triaged. label Aug 1, 2023
@nicholaszein nicholaszein changed the title v3.15.0 Critical ⛔ 📚 🐞 Bug Report: Custom Widget does not work if methods are separated on different files Aug 3, 2023
@nicholaszein nicholaszein added compatibility/3rd-party Indicates a compatibility problem with a 3rd-party plugin or theme. type/developer-api Indicates when a topic is related to the Developer API and Documentation. component/code Indicates when a topic is related to a component’s code. and removed status/awaiting_triage Indicates when an Issue, Pull Request, or Discussion awaits to be triaged. labels Aug 3, 2023
@nicholaszein
Copy link
Member

Hi, @babakfp,

Thank you for reaching out! 🙏

⛔ After reviewing your report we concluded this is not a bug caused by Elementor. The feature you're referring to is not yet supported.

You need to follow the correct method of creating the Elementor add-on widget as explained in our Developer API. You forgot to call the necessary classes and to include all methods in the same file.

Please follow the Developer Documentation to learn how to properly create your custom add-ons:
https://developers.elementor.com/docs/getting-started/

👍 For now, that's all we can help with.

Kind regards

@nicholaszein nicholaszein closed this as not planned Won't fix, can't repro, duplicate, stale Aug 3, 2023
@elementor elementor locked and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compatibility/3rd-party Indicates a compatibility problem with a 3rd-party plugin or theme. component/code Indicates when a topic is related to a component’s code. mod* type/developer-api Indicates when a topic is related to the Developer API and Documentation.
Projects
None yet
Development

No branches or pull requests

2 participants