Allow widget forms to work standalone, without being inside the customizer control context #26
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.
Remove forms dependency on customize-widgets; allow standalone forms to allow for Shortcake or frontend integrations
WidgetControl
as a property when constructing a Form; instead pass the model(which can be a Setting or a Value) and id_base directly, the latter of which should already be located
on the Form prototype along with the config.
wp.customize.Widgets.formConstructor
withwp.widgets.formConstructor
wp.customize.Widgets.Form
withwp.widgets.Form
WP_JS_Widget::render_form_template_scripts()
which outputs the script tags.WP_JS_Widget::render_form_template()
.id_base
property for JS Form class, addingtemplate_id
form config which is then sourced from a newWP_JS_Widget::get_form_template_id()
, which in turn is used byWP_JS_Widget::render_form_template_scripts()
and is used in the JSForm#getTemplate
method.Todo:
Allow JS widgets to work on the widgets admin screen.Restore ability forupdate
method to be invoked. Ifsanitize
returnsWP_Error
then returnfalse
.This is a dependency for #11, to integrate with Shortcake.