Make WordPress Core


Ignore:
Timestamp:
09/27/2015 01:03:31 AM (9 years ago)
Author:
DrewAPicture
Message:

Docs: Improve documentation for the __construct(), widget(), update(), form(), and _get_current_taxonomy() methods in WP_Widget_Categories.

Props leemon.
Fixes #34018. See #34013.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-categories.php

    r34431 r34618  
    1818class WP_Widget_Categories extends WP_Widget {
    1919
     20    /**
     21     * Sets up a new Categories widget instance.
     22     *
     23     * @since 2.8.0
     24     * @access public
     25     */
    2026    public function __construct() {
    2127        $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) );
     
    2430
    2531    /**
    26      * @staticvar bool $first_dropdown
    27      *
    28      * @param array $args
    29      * @param array $instance
     32     * Outputs the content for the current Categories widget instance.
     33     *
     34     * @since 2.8.0
     35     * @access public
     36     *
     37     * @param array $args     Display arguments including 'before_title', 'after_title',
     38     *                        'before_widget', and 'after_widget'.
     39     * @param array $instance Settings for the current Categories widget instance.
    3040     */
    3141    public function widget( $args, $instance ) {
     
    7484             */
    7585            wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args ) );
    76 ?>
     86            ?>
    7787
    7888<script type='text/javascript'>
     
    114124
    115125    /**
    116      * @param array $new_instance
    117      * @param array $old_instance
    118      * @return array
     126     * Handles updating settings for the current Categories widget instance.
     127     *
     128     * @since 2.8.0
     129     * @access public
     130     *
     131     * @param array $new_instance New settings for this instance as input by the user via
     132     *                            WP_Widget::form().
     133     * @param array $old_instance Old settings for this instance.
     134     * @return array Updated settings to save.
    119135     */
    120136    public function update( $new_instance, $old_instance ) {
     
    130146
    131147    /**
    132      * @param array $instance
     148     * Outputs the settings form for the Categories widget.
     149     *
     150     * @since 2.8.0
     151     * @access public
     152     *
     153     * @param array $instance Current settings.
    133154     */
    134155    public function form( $instance ) {
     
    140161        $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
    141162        $current_taxonomy = $this->_get_current_taxonomy( $instance );
    142 ?>
     163        ?>
    143164        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
    144165        <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 ); ?>" /></p>
     
    166187        <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> />
    167188        <label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
    168 <?php
    169     }
    170 
    171     /**
    172      * Retrieves the taxonomy for the current widget instance.
     189        <?php
     190    }
     191
     192    /**
     193     * Retrieves the taxonomy for the current Categories widget instance.
    173194     *
    174195     * @since 4.4.0
Note: See TracChangeset for help on using the changeset viewer.