xwp / wp-widget-customizer

[OBSOLETE] Widget Customizer plugin for WordPress (now merged into Core)
http://wordpress.org/plugins/widget-customizer/
54 stars 18 forks source link

Make it easier for widgets to opt-in to live previews #67

Closed westonruter closed 10 years ago

westonruter commented 10 years ago

Right now the method is:

add_filter( 'customizer_widget_live_previewable_{id_base}', '__return_true' );

But it would be nice if there was a way to supply this in the arguments supplied to the widget constructor:

class Lightbox_Widget extends WP_Widget {
    function __construct() {
        parent::__construct(
            'lightbox',
            __( 'Lightbox', 'lightbox-widget' ),
            array( 
                'description' => __( 'Displays a button which opens a lightbox to show the supplied content.', 'lightbox-widget' ),
                'customizer_support' => true,
            )
        );
...

See also comment on wordpress-dev by Nacin.