wp/wp-includes/widgets/class-wp-widget-tag-cloud.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    23 	 */
    23 	 */
    24 	public function __construct() {
    24 	public function __construct() {
    25 		$widget_ops = array(
    25 		$widget_ops = array(
    26 			'description'                 => __( 'A cloud of your most used tags.' ),
    26 			'description'                 => __( 'A cloud of your most used tags.' ),
    27 			'customize_selective_refresh' => true,
    27 			'customize_selective_refresh' => true,
       
    28 			'show_instance_in_rest'       => true,
    28 		);
    29 		);
    29 		parent::__construct( 'tag_cloud', __( 'Tag Cloud' ), $widget_ops );
    30 		parent::__construct( 'tag_cloud', __( 'Tag Cloud' ), $widget_ops );
    30 	}
    31 	}
    31 
    32 
    32 	/**
    33 	/**
    88 		echo $args['before_widget'];
    89 		echo $args['before_widget'];
    89 		if ( $title ) {
    90 		if ( $title ) {
    90 			echo $args['before_title'] . $title . $args['after_title'];
    91 			echo $args['before_title'] . $title . $args['after_title'];
    91 		}
    92 		}
    92 
    93 
       
    94 		$format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml';
       
    95 
       
    96 		/** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */
       
    97 		$format = apply_filters( 'navigation_widgets_format', $format );
       
    98 
       
    99 		if ( 'html5' === $format ) {
       
   100 			// The title may be filtered: Strip out HTML and make sure the aria-label is never empty.
       
   101 			$title      = trim( strip_tags( $title ) );
       
   102 			$aria_label = $title ? $title : $default_title;
       
   103 			echo '<nav role="navigation" aria-label="' . esc_attr( $aria_label ) . '">';
       
   104 		}
       
   105 
    93 		echo '<div class="tagcloud">';
   106 		echo '<div class="tagcloud">';
    94 
   107 
    95 		echo $tag_cloud;
   108 		echo $tag_cloud;
    96 
   109 
    97 		echo "</div>\n";
   110 		echo "</div>\n";
       
   111 
       
   112 		if ( 'html5' === $format ) {
       
   113 			echo '</nav>';
       
   114 		}
       
   115 
    98 		echo $args['after_widget'];
   116 		echo $args['after_widget'];
    99 	}
   117 	}
   100 
   118 
   101 	/**
   119 	/**
   102 	 * Handles updating settings for the current Tag Cloud widget instance.
   120 	 * Handles updating settings for the current Tag Cloud widget instance.