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

Props leemon.
Fixes #34026. See #34013.

Built from https://develop.svn.wordpress.org/trunk@34610


git-svn-id: http://core.svn.wordpress.org/trunk@34574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2015-09-27 00:32:24 +00:00
parent 83da7624e6
commit 08277293e5
2 changed files with 37 additions and 9 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34609';
$wp_version = '4.4-alpha-34610';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -16,14 +16,26 @@
*/
class WP_Widget_Tag_Cloud extends WP_Widget {
/**
* Sets up a new Tag Cloud widget instance.
*
* @since 2.8.0
* @access public
*/
public function __construct() {
$widget_ops = array( 'description' => __( "A cloud of your most used tags.") );
parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops);
}
/**
* @param array $args
* @param array $instance
* Outputs the content for the current Tag Cloud widget instance.
*
* @since 2.8.0
* @access public
*
* @param array $args Display arguments including 'before_title', 'after_title',
* 'before_widget', and 'after_widget'.
* @param array $instance Settings for the current Tag Cloud widget instance.
*/
public function widget( $args, $instance ) {
$current_taxonomy = $this->_get_current_taxonomy($instance);
@ -74,9 +86,15 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
}
/**
* @param array $new_instance
* @param array $old_instance
* @return array
* Handles updating settings for the current Tag Cloud widget instance.
*
* @since 2.8.0
* @access public
*
* @param array $new_instance New settings for this instance as input by the user via
* WP_Widget::form().
* @param array $old_instance Old settings for this instance.
* @return array Settings to save or bool false to cancel saving.
*/
public function update( $new_instance, $old_instance ) {
$instance = array();
@ -86,7 +104,12 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
}
/**
* @param array $instance
* Outputs the Tag Cloud widget settings form.
*
* @since 2.8.0
* @access public
*
* @param array $instance Current settings.
*/
public function form( $instance ) {
$current_taxonomy = $this->_get_current_taxonomy($instance);
@ -141,8 +164,13 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
}
/**
* @param array $instance
* @return string
* Retrieves the taxonomy for the current Tag cloud widget instance.
*
* @since 4.4.0
* @access public
*
* @param array $instance Current settings.
* @return string Name of the current taxonomy if set, otherwise 'post_tag'.
*/
public function _get_current_taxonomy($instance) {
if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )