Skip to content

Commit

Permalink
Fix. Bug Affecting Widgets without description
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Mar 22, 2019
1 parent c619130 commit fba1311
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ function gutenberg_legacy_widget_settings( $settings ) {
if ( ! in_array( $class, $core_widgets ) ) {
$available_legacy_widgets[ $class ] = array(
'name' => html_entity_decode( $widget_obj->name ),
'description' => html_entity_decode( $widget_obj->widget_options['description'] ),
// wp_widget_description is not being used because its input parameter is a Widget Id.
// Widgets id's reference to a specific widget instance.
// Here we are iterating on all the available widget classes even if no widget instance exists for them.
'description' => isset( $widget_obj->widget_options['description'] ) ?
html_entity_decode( $widget_obj->widget_options['description'] ) :
null,
'isCallbackWidget' => false,
);
}
Expand All @@ -110,7 +115,7 @@ function gutenberg_legacy_widget_settings( $settings ) {
}
$available_legacy_widgets[ $widget_id ] = array(
'name' => html_entity_decode( $widget_obj['name'] ),
'description' => null,
'description' => html_entity_decode( wp_widget_description( $widget_id ) ),
'isCallbackWidget' => true,
);
}
Expand Down

0 comments on commit fba1311

Please sign in to comment.