Feat: Add refreshWidgets() API for dynamic widget list updates [ED-23311]#35156
Draft
Omerisra6 wants to merge 4 commits intoelementor:mainfrom
Draft
Feat: Add refreshWidgets() API for dynamic widget list updates [ED-23311]#35156Omerisra6 wants to merge 4 commits intoelementor:mainfrom
refreshWidgets() API for dynamic widget list updates [ED-23311]#35156Omerisra6 wants to merge 4 commits intoelementor:mainfrom
Conversation
…23311] Add a standard API (`elementor.refreshWidgets()`) that allows refreshing the editor widget list at runtime without a page reload. This enables third-party developers and extensions (e.g., Angie AI) to dynamically register or update widgets and have them appear in the editor immediately. Changes: - New PHP AJAX endpoint `refresh_widgets_config` that returns full widget configs (title, icon, categories, keywords, controls) plus categories - New JS method `refreshWidgets()` on EditorBase that fetches fresh data, replaces widgetsCache atomically, updates categories, and refreshes panel + preview - Fires `elementor/widgets/refreshed` hook for extensibility - Returns a Promise for reliable success/failure handling Made-with: Cursor
Skip element presets whose originalWidget is not found in widgetsCache instead of crashing with a TypeError. This is a pre-existing edge case that surfaces when widgets are dynamically refreshed or when a preset references a widget that failed to register. Made-with: Cursor
…311] Widget_Base::get_initial_config() conditionally includes controls only when the controls stack is already initialized. During AJAX requests the stack is not yet initialized, so get_config() returned widget metadata without controls. Explicitly call get_stack(false) to force initialization. Made-with: Cursor
1babc8e to
c4ac1bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a public
elementor.refreshWidgets()API that lets third-party code (e.g. Angie) dynamically register new widgets on the server side and then refresh the editor's widget list without a full page reload.refresh_widgets_configthat returns the complete widget + category configuration (including controls with defaults).async refreshWidgets()method on the editor instance that fetches the updated config, replaceswidgetsCache, updates panel categories, refreshes the panel route, and reloads the preview iframe.Jira
https://elementor.atlassian.net/browse/ED-23311
Usage Example
What happens under the hood
widgetsCacheis cleared and rebuilt with the fresh data.elementor/widgets/refreshedhook fires (for any listeners).Test plan
await elementor.refreshWidgets()in the browser console