From 3e0e0f453ec6b4d5632d1ae07d8a952b1a10fcf1 Mon Sep 17 00:00:00 2001 From: "Drew Jaynes (DrewAPicture)" Date: Sun, 7 Dec 2014 20:07:05 +0000 Subject: [PATCH] Introduce documentation for three methods in `WP_Widget_Factory`: `register()`, `unregister()`, `_register_widgets()`. See #30315. git-svn-id: https://develop.svn.wordpress.org/trunk@30774 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/widgets.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php index adee3ec8f4..ec0effe6b3 100644 --- a/src/wp-includes/widgets.php +++ b/src/wp-includes/widgets.php @@ -548,15 +548,37 @@ class WP_Widget_Factory { add_action( 'widgets_init', array( $this, '_register_widgets' ), 100 ); } - public function register($widget_class) { + /** + * Register a widget subclass. + * + * @since 2.8.0 + * @access public + * + * @param string $widget_class The name of a {@see WP_Widget} subclass. + */ + public function register( $widget_class ) { $this->widgets[$widget_class] = new $widget_class(); } - public function unregister($widget_class) { + /** + * Un-register a widget subclass. + * + * @since 2.8.0 + * @access public + * + * @param string $widget_class The name of a {@see WP_Widget} subclass. + */ + public function unregister( $widget_class ) { if ( isset($this->widgets[$widget_class]) ) unset($this->widgets[$widget_class]); } + /** + * Utility method for adding widgets to the registered widgets global. + * + * @since 2.8.0 + * @access public + */ public function _register_widgets() { global $wp_registered_widgets; $keys = array_keys($this->widgets);