Improve inline documentation for four methods in `WP_Widget`: `get_field_id()`, `display_callback()`, `update_callback()`, and `form_callback()`.

Props jazzs3quence for the initial patch.
See #30315.


git-svn-id: https://develop.svn.wordpress.org/trunk@30691 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes (DrewAPicture) 2014-12-01 19:34:25 +00:00
parent e8ac9b21df
commit 2f64100369
1 changed files with 18 additions and 9 deletions

View File

@ -132,14 +132,18 @@ class WP_Widget {
} }
/** /**
* Constructs id attributes for use in form() fields * Constructs id attributes for use in {@see WP_Widget::form()} fields.
* *
* This function should be used in form() methods to create id attributes for fields to be saved by update() * This function should be used in form() methods to create id attributes
* for fields to be saved by {@see WP_Widget::update()}.
* *
* @param string $field_name Field name * @since 2.8.0
* @return string ID attribute for $field_name * @access public
*
* @param string $field_name Field name.
* @return string ID attribute for `$field_name`.
*/ */
public function get_field_id($field_name) { public function get_field_id( $field_name ) {
return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name; return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name;
} }
@ -220,6 +224,7 @@ class WP_Widget {
* *
* Finds the instance and calls {@see WP_Widget::widget()}. * Finds the instance and calls {@see WP_Widget::widget()}.
* *
* @since 2.8.0
* @access public * @access public
* *
* @param array $args Display arguments. See {@see WP_Widget::widget()} for information * @param array $args Display arguments. See {@see WP_Widget::widget()} for information
@ -273,9 +278,10 @@ class WP_Widget {
} }
/** /**
* Deal with changed settings. * Deal with changed settings (Do NOT override).
* *
* Do NOT over-ride this function. * @since 2.8.0
* @access public
* *
* @param int $deprecated Not used. * @param int $deprecated Not used.
*/ */
@ -355,9 +361,12 @@ class WP_Widget {
} }
/** /**
* Generate the control form. * Generate the widget control form (Do NOT override).
* *
* Do NOT over-ride this function. * @since 2.8.0
* @access public
*
* @param int|array $widget_args Widget instance number or array of widget arguments.
*/ */
public function form_callback( $widget_args = 1 ) { public function form_callback( $widget_args = 1 ) {
if ( is_numeric($widget_args) ) if ( is_numeric($widget_args) )