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

Allow widget forms to work standalone, without being inside the customizer control context #26

Merged
merged 8 commits into from
Jan 8, 2017

Conversation

westonruter
Copy link
Contributor

@westonruter westonruter commented Jan 7, 2017

Remove forms dependency on customize-widgets; allow standalone forms to allow for Shortcake or frontend integrations

  • Remove the passing of the 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.
  • Replace wp.customize.Widgets.formConstructor with wp.widgets.formConstructor
  • Replace wp.customize.Widgets.Form with wp.widgets.Form
  • Eliminate exporting all form configs to CustomizeJSWidgets.data.form_configs and instead attach to From prototypes.
  • Fix initialization of Pages widget in how it amends the default config.
  • Add Form.notifications
  • Rename script handles to be more appropriate.
  • Fix PHP warning for array to string conversion in Pages widget.
  • Prevent RSS widget from showing error when feed URL is empty.
  • Reduce duplicated code for rendering form templates.
  • Breaking change: Converts/renames WP_JS_Widget::form_template() into wrapper method WP_JS_Widget::render_form_template_scripts() which outputs the script tags.
  • Splits out form template contents into WP_JS_Widget::render_form_template().
  • Eliminates extraneous id_base property for JS Form class, adding template_id form config which is then sourced from a new WP_JS_Widget::get_form_template_id(), which in turn is used by WP_JS_Widget::render_form_template_scripts() and is used in the JS Form#getTemplate method.
  • Ensure that notifications for the setting (model) render even when the form is embedded outside the customizer.

Todo:

  • Make sure that Notifications render properly when not in a control context.
  • Allow JS widgets to work on the widgets admin screen.
  • Restore ability for update method to be invoked. If sanitize returns WP_Error then return false.

This is a dependency for #11, to integrate with Shortcake.

…to allow for Shortcake or frontend integrations

* Remove the passing of the 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.
* Replace wp.customize.Widgets.formConstructor with wp.widgets.formConstructor.archives
* Replace wp.customize.Widgets.Form with wp.widgets.Form
* Eliminate exporting all form configs to CustomizeJSWidgets.data.form_configs and instead attach to From prototypes.
* Fix initialization of Pages widget in how it amends the default config.
* Add Form.notifications
* Rename script handles to be more appropriate.
* Converts/renames WP_JS_Widget::form_template() into wrapper method WP_JS_Widget::render_form_template_scripts() which outputs the script tags.
* Splits out form template contents into `WP_JS_Widget::render_form_template()`.
* Eliminates extraneous `id_base` property for JS Form class, adding `template_id` form config which is then sourced from a new WP_JS_Widget::get_form_template_id(), which in turn is used by WP_JS_Widget::render_form_template_scripts() and is used in the JS Form#getTemplate() method.
@westonruter westonruter merged commit f261e9f into develop Jan 8, 2017
@westonruter westonruter modified the milestone: 0.3.0 Jan 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant