Make WordPress Core

Ticket #9756: 9756.patch

File 9756.patch, 1.3 KB (added by hakre, 16 years ago)

Search Widget gets a Title

  • wp-includes/default-widgets.php

     
    179179
    180180        function widget( $args, $instance ) {
    181181                extract($args);
     182                $title = apply_filters('widget_title', $instance['title']);
     183
    182184                echo $before_widget;
     185                if ( $title )
     186                        echo $before_title . $title . $after_title;
    183187
    184188                // Use current theme search form if it exists
    185189                get_search_form();
    186190
    187191                echo $after_widget;
    188192        }
     193       
     194        function form( $instance ) {
     195                $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
     196                $title = $instance['title'];
     197?>
     198                <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
     199<?php
     200        }
     201       
     202        function update( $new_instance, $old_instance ) {
     203                $instance = $old_instance;
     204                $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
     205                $instance['title'] = strip_tags($new_instance['title']);
     206                // $instance['count'] = $new_instance['count'] ? 1 : 0;
     207                // $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
     208                return $instance;
     209        }       
     210       
    189211}
    190212
    191213/**