JS Widgets
The next generation of widgets in core, embracing JS for UI and powering the Widgets REST API.
Contributors: xwp, westonruter
Tags: customizer, widgets, rest-api
Requires at least: 4.5
Tested up to: 4.7-alpha
Stable tag: 0.1.1
License: GPLv2 or later
Description
Also could be known as Widget Customizer 2.0, Widgets 3.0, or Widgets Next Generation.
This plugin implements:
- WP-CORE#33507: Allow widget controls to be JS-driven.
- WP-CORE#35574: Add REST API JSON schema information to WP_Widget.
- WP-API#19: Add widget endpoints to the WP REST API.
Plugin Dependencies:
- WordPress REST API v2
- Customize Setting Validation (recommended)
Features:
- Widget instance settings in the Customizer are exported from PHP as regular JSON without any PHP-serialized base64-encoded
encoded_serialized_instance. - Customizer settings can be directly mutated via JavaScript instead of needing to do an
update-widgetAdmin Ajax roundtrip; this greatly speeds up previewing. - Widget have a technology-agnostic JS API for building their forms, allowing Backbone, React, or any other frontend technology to be used for managing the form.
- Compatible with widgets stored in a custom post type instead of options, via the Widget Posts module in the Customize Widgets Plus plugin.
- Compatible with Customize Snapshots, allowing changes made in the Customizer to be applied to requests for widgets via the REST API.
- Compatible with Customize Setting Validation.
- Includes (eventually) re-implementation of all core widgets using the new
WP_JS_WidgetAPI.
Limitations/Caveats:
- Widgets that extend
WP_JS_Widgetwill not be editable from widgets admin page. A link to edit the widget in the Customizer will be displayed instead. - Only widgets that extend
WP_JS_Widgetwill be exposed via the REST API. The plugin includes aWP_JS_Widgetproxy class which demonstrates how to adapt existingWP_Widgetclasses for the new widget functionality.
Changelog
0.1.1 - 2016-10-03
- Add 100% width to object-selector.
- Fix typo in sanitizing Post Collection input.
- Fix PHP issue when attempting to assign an undefined array index to another undefined array index.
- Fix styling of post collection widget select2 component.
- Fix accounting for parse_widget_setting_id returning WP_Error not false.
0.1.0 - 2016-08-24
Initial release.