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

Additional hook on 'editor_get_wp_widget_form' success #1886

MjHead opened this issue Jun 22, 2017 · 2 comments

Additional hook on 'editor_get_wp_widget_form' success #1886

MjHead opened this issue Jun 22, 2017 · 2 comments


Copy link

@MjHead MjHead commented Jun 22, 2017

Hi guys, thanks for great and clean-coded plugin first of all! At second - can you please research ability to add one tine feature, that can be very helpful for developers, who uses Elementor. Detailed:

1. The Problem

If theme or plugin has own widgets, them automatically added to WordPress section in editor. When user inserts this widget into page, widget's controls form renders on back-end on elementor_editor_get_wp_widget_form. If widget uses simple controls - all fine, but if widget use some complex controls, like Media Upload button for example - not always has possibility to initialize JS events for this controls. In last release you have added fix for the same problem for new WP core widgets - media and rich-editable text. But would be great if would be universal solution for such widgets.

2. Possible solution

Specific hook on AJAX success callback could be such solution, for example after this code - I tried to add such hook. I added following code after

elementor.hooks.doAction( 'panel/open_editor/wp_widget_form/' + this.model.get( 'widget' ), this );

Than I could add callback for this hook into my script (example):

elementor.hooks.addAction( 'panel/open_editor/wp_widget_form/wp-widget-my_widget_about', function( panel ) {

	if ( panel.ui.form.length ) {
		$( 'body' ).trigger( {
			type: 'my-ui-elements-init-trigger',
			_target: panel.ui.form
		} );

} );

Existing hooks panel/open_editor/{elementType} and panel/open_editor/{elementType}/{elementName} are triggering after AJAX send, but before AJAX success, so developers can't perform any operations with widgets forms content on this hooks. So additional hook on AJAX success make this part of editor more flexible for developers.

Thanks, Andrew.

KingYes added a commit that referenced this issue Jul 12, 2017
Copy link

@KingYes KingYes commented Jul 12, 2017

Hey @MjHead

Thank you very much 👍

Copy link

@MjHead MjHead commented Jul 12, 2017

Hi @KingYes

Thanks for implementing! Waiting for release 😄

P.S. Thanks again for great plugin!

@KingYes KingYes closed this Jul 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants