WordPress.org

Make WordPress Core

Changeset 34560


Ignore:
Timestamp:
09/25/2015 08:30:02 PM (4 years ago)
Author:
DrewAPicture
Message:

Docs: Improve the method docs for the widget(), update(), form(), and __construct() methods in the WP_Widget base class.

See #34013. See #32246.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-widget.php

    r34392 r34560  
    8888
    8989    /**
    90      * Echo the widget content.
    91      *
    92      * Subclasses should over-ride this function to generate their widget code.
    93      *
    94      * @since 2.8.0
    95      * @access public
    96      *
    97      * @param array $args     Display arguments including before_title, after_title,
    98      *                        before_widget, and after_widget.
     90     * Echoes the widget content.
     91     *
     92     * Sub-classes should over-ride this function to generate their widget code.
     93     *
     94     * @since 2.8.0
     95     * @access public
     96     *
     97     * @param array $args     Display arguments including 'before_title', 'after_title',
     98     *                        'before_widget', and 'after_widget'.
    9999     * @param array $instance The settings for the particular instance of the widget.
    100100     */
     
    104104
    105105    /**
    106      * Update a particular instance.
    107      *
    108      * This function should check that $new_instance is set correctly. The newly-calculated
     106     * Updates a particular instance of a widget.
     107     *
     108     * This function should check that `$new_instance` is set correctly. The newly-calculated
    109109     * value of `$instance` should be returned. If false is returned, the instance won't be
    110110     * saved/updated.
     
    114114     *
    115115     * @param array $new_instance New settings for this instance as input by the user via
    116      *                            {@see WP_Widget::form()}.
     116     *                            WP_Widget::form().
    117117     * @param array $old_instance Old settings for this instance.
    118118     * @return array Settings to save or bool false to cancel saving.
     
    123123
    124124    /**
    125      * Output the settings update form.
     125     * Outputs the settings update form.
    126126     *
    127127     * @since 2.8.0
     
    131131     * @return string Default return is 'noform'.
    132132     */
    133     public function form($instance) {
     133    public function form( $instance ) {
    134134        echo '<p class="no-options-widget">' . __('There are no options for this widget.') . '</p>';
    135135        return 'noform';
     
    147147     *                                a portion of the widget's class name will be used Has to be unique.
    148148     * @param string $name            Name for the widget displayed on the configuration page.
    149      * @param array  $widget_options  Optional. Widget options. See {@see wp_register_sidebar_widget()} for
     149     * @param array  $widget_options  Optional. Widget options. See wp_register_sidebar_widget() for information
     150     *                                on accepted arguments. Default empty array.
     151     * @param array  $control_options Optional. Widget control options. See wp_register_widget_control() for
    150152     *                                information on accepted arguments. Default empty array.
    151      * @param array  $control_options Optional. Widget control options. See {@see wp_register_widget_control()}
    152      *                                for information on accepted arguments. Default empty array.
    153153     */
    154154    public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) {
     
    161161
    162162    /**
    163      * PHP4 constructor
     163     * PHP4 constructor.
    164164     *
    165165     * @param string $id_base
Note: See TracChangeset for help on using the changeset viewer.