@@ -16,24 +16,26 @@ var WidgetCustomizer = (function ($) {
1616 var control = this ;
1717
1818 control . setting . bind ( function ( to ) {
19- control . update_widget ( to ) ;
19+ control . updateWidget ( to ) ;
2020 } ) ;
2121
2222 control . container . find ( '.widget-control-update' ) . on ( 'click' , function ( e ) {
23- control . update_widget ( ) ;
23+ control . updateWidget ( ) ;
2424 } ) ;
2525
2626 control . setting . previewer . channel . bind ( 'synced' , function ( ) {
2727 control . container . removeClass ( 'previewer-loading' ) ;
2828 } ) ;
2929
30- control . controlTabs ( ) ;
30+ control . setupControlToggle ( ) ;
31+
32+ control . setupWidgetTitle ( ) ;
3133 } ,
3234
3335 /**
3436 * @param {object } instance_override When the model changes, the instance is sent this way
3537 */
36- update_widget : function ( instance_override ) {
38+ updateWidget : function ( instance_override ) {
3739 var control = this ;
3840 var data = control . container . find ( ':input' ) . serialize ( ) ;
3941 control . container . addClass ( 'widget-form-loading' ) ;
@@ -72,7 +74,7 @@ var WidgetCustomizer = (function ($) {
7274 } ) ;
7375 } ,
7476
75- controlTabs : function ( ) {
77+ setupControlToggle : function ( ) {
7678 var control = this ;
7779 control . container . find ( '.widget-top' ) . on ( 'click' , function ( e ) {
7880 // Copied from wpWidgets.init() in wp-admin/js/widgets.js
@@ -88,9 +90,27 @@ var WidgetCustomizer = (function ($) {
8890 }
8991 e . preventDefault ( ) ;
9092 } ) ;
93+ } ,
9194
92- }
95+ setupWidgetTitle : function ( ) {
96+ var control = this ;
97+ control . setting . bind ( function ( to ) {
98+ control . updateInWidgetTitle ( ) ;
99+ } ) ;
100+ control . updateInWidgetTitle ( ) ;
101+ } ,
93102
103+ updateInWidgetTitle : function ( ) {
104+ var control = this ;
105+ var title = control . setting ( ) . title ;
106+ var in_widget_title = control . container . find ( '.in-widget-title' ) ;
107+ if ( title ) {
108+ in_widget_title . text ( ': ' + title ) ;
109+ }
110+ else {
111+ in_widget_title . text ( '' ) ;
112+ }
113+ }
94114 } ) ;
95115
96116 // Note that 'widget_form' must match the Widget_Form_WP_Customize_Control::$type
0 commit comments