Docs: Improve documentation for the `__construct()`, `widget()`, `update()`, and `form()` methods in `WP_Nav_Menu_Widget`.
Props leemon. Fixes #34015. Fixes #34013. Built from https://develop.svn.wordpress.org/trunk@34621 git-svn-id: http://core.svn.wordpress.org/trunk@34585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c1796c55c3
commit
ad089ffe15
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34620';
|
$wp_version = '4.4-alpha-34621';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core class used to implement the Navigation Menu widget.
|
* Core class used to implement the Custom Menu widget.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
|
@ -16,14 +16,26 @@
|
||||||
*/
|
*/
|
||||||
class WP_Nav_Menu_Widget extends WP_Widget {
|
class WP_Nav_Menu_Widget extends WP_Widget {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up a new Custom Menu widget instance.
|
||||||
|
*
|
||||||
|
* @since 3.0.0
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$widget_ops = array( 'description' => __('Add a custom menu to your sidebar.') );
|
$widget_ops = array( 'description' => __('Add a custom menu to your sidebar.') );
|
||||||
parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
|
parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $args
|
* Outputs the content for the current Custom Menu widget instance.
|
||||||
* @param array $instance
|
*
|
||||||
|
* @since 3.0.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 Custom Menu widget instance.
|
||||||
*/
|
*/
|
||||||
public function widget( $args, $instance ) {
|
public function widget( $args, $instance ) {
|
||||||
// Get menu
|
// Get menu
|
||||||
|
@ -65,9 +77,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $new_instance
|
* Handles updating settings for the current Custom Menu widget instance.
|
||||||
* @param array $old_instance
|
*
|
||||||
* @return array
|
* @since 3.0.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 Updated settings to save.
|
||||||
*/
|
*/
|
||||||
public function update( $new_instance, $old_instance ) {
|
public function update( $new_instance, $old_instance ) {
|
||||||
$instance = array();
|
$instance = array();
|
||||||
|
@ -81,7 +99,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $instance
|
* Outputs the settings form for the Custom Menu widget.
|
||||||
|
*
|
||||||
|
* @since 3.0.0
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param array $instance Current settings.
|
||||||
*/
|
*/
|
||||||
public function form( $instance ) {
|
public function form( $instance ) {
|
||||||
$title = isset( $instance['title'] ) ? $instance['title'] : '';
|
$title = isset( $instance['title'] ) ? $instance['title'] : '';
|
||||||
|
|
Loading…
Reference in New Issue