Make WordPress Core

Changeset 10812


Ignore:
Timestamp:
03/18/2009 07:20:58 AM (18 years ago)
Author:
ryan
Message:

Add some phpdoc to WP_Widget. see #8441

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/widgets.php

    r10810 r10812  
    8989        // Member functions that you must over-ride.
    9090
    91         /** Echo the actual widget content. Subclasses should over-ride this function
    92          *      to generate their widget code. */
     91        /** Echo the widget content.
     92         *
     93         * Subclasses should over-ride this function to generate their widget code.
     94         *
     95         * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
     96         * @param array $instance The settings for the particular instance of the widget
     97         */
    9398        function widget($args, $instance) {
    9499                die('function WP_Widget::widget() must be over-ridden in a sub-class.');
    … …  
    96101
    97102        /** Update a particular instance.
    98          *      This function should check that $new_instance is set correctly.
    99          *      The newly calculated value of $instance should be returned. */
     103         *
     104         * This function should check that $new_instance is set correctly.
     105         * The newly calculated value of $instance should be returned.
     106         *
     107         * @param array $new_instance New settings for this instance as input by the user via form()
     108         * @param array $old_instance Old settings for this instance
     109         * @return array Settings to save
     110         */
    100111        function update($new_instance, $old_instance) {
    101112                return $new_instance;
    102113        }
    103114
    104         /** Echo a control form for the current instance. */
     115        /** Echo the settings update form
     116         *
     117         * @param array $instance Current settings
     118         */
    105119        function form($instance) {
    106120                echo '<p>' . __('There are no options for this widget.') . '</p>';
    … …  
    135149        }
    136150
    137         /** Helper function to be called by form().
    138          *      Returns an HTML name for the field. */
     151        /** Constructs name attributes for use in form() fields
     152         *
     153         * This function should be used in form() methods to create name attributes for fields to be saved by update()
     154         *
     155         * @param string $field_name Field name
     156         * @return string Name attribute for $field_name
     157         */
    139158        function get_field_name($field_name) {
    140159                return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']';
    141160        }
    142161
    143         /** Helper function to be called by form().
    144          *      Returns an HTML id for the field. */
     162        /** Constructs id attributes for use in form() fields
     163         *
     164         * This function should be used in form() methods to create id attributes for fields to be saved by update()
     165         *
     166         * @param string $field_name Field name
     167         * @return string ID attribute for $field_name
     168         */
    145169        function get_field_id($field_name) {
    146170                return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name;
    147171        }
    148172
    149         /** Registers this widget-type.
    150          *      Called during the 'widgets_init' action. */
     173        // Private Functions. Don't worry about these.
     174
    151175        function _register() {
    152176                $settings = $this->get_settings();
    … …  
    166190                }
    167191        }
    168 
    169         // Private Functions. Don't worry about these.
    170192
    171193        function _set($number) {
Note: See TracChangeset for help on using the changeset viewer.