Introduce documentation for three methods in WP_Widget_Factory: register(), unregister(), _register_widgets().

See #30315.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2014-12-07 20:08:21 +00:00
parent 25a65d856b
commit 1f8f2e5ba1
2 changed files with 25 additions and 3 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.1-beta2-30773';
$wp_version = '4.1-beta2-30774';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -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);