| @@ -32,12 +32,13 @@ | ||
| 32 | 32 | * @since 0.1 |
| 33 | 33 | * |
| 34 | 34 | * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. |
| 35 | 35 | * @param array $instance The settings for the particular instance of the widget |
| 36 | + * @return void | |
| 36 | 37 | */ |
| 37 | 38 | public function widget( $args, $instance ) { |
| 38 | 39 | // Sets a unique id for dropdown. |
| 39 | - $instance['dropdown'] = empty( $instance['dropdown'] ) ? 0 : $args['widget_id']; | |
| 40 | + $instance['dropdown'] = empty( $instance['dropdown'] ) ? 0 : $this->id; | |
| 40 | 41 | |
| 41 | 42 | if ( $list = pll_the_languages( array_merge( $instance, array( 'echo' => 0 ) ) ) ) { |
| 42 | 43 | $title = empty( $instance['title'] ) ? '' : $instance['title']; |
| 43 | 44 | |
| @@ -98,13 +99,14 @@ | ||
| 98 | 99 | return $instance; |
| 99 | 100 | } |
| 100 | 101 | |
| 101 | 102 | /** |
| 102 | - * Displays the widget form | |
| 103 | + * Displays the widget form. | |
| 103 | 104 | * |
| 104 | 105 | * @since 0.4 |
| 105 | 106 | * |
| 106 | - * @param array $instance Current settings | |
| 107 | + * @param array $instance Current settings. | |
| 108 | + * @return string | |
| 107 | 109 | */ |
| 108 | 110 | public function form( $instance ) { |
| 109 | 111 | // Default values |
| 110 | 112 | $instance = wp_parse_args( (array) $instance, array_merge( array( 'title' => '' ), PLL_Switcher::get_switcher_options( 'widget', 'default' ) ) ); |
| @@ -129,6 +131,8 @@ | ||
| 129 | 131 | ( ! empty( $instance['dropdown'] ) && in_array( $key, array( 'show_names', 'show_flags', 'hide_current' ) ) ? ' style="display:none;"' : '' ), |
| 130 | 132 | esc_attr( 'pll-' . $key ) |
| 131 | 133 | ); |
| 132 | 134 | } |
| 135 | + | |
| 136 | + return ''; // Because the parent class returns a string, however not used. | |
| 133 | 137 | } |
| 134 | 138 | } |