Changeset 10812
- Timestamp:
- 03/18/2009 07:20:58 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/widgets.php
r10810 r10812 89 89 // Member functions that you must over-ride. 90 90 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 */ 93 98 function widget($args, $instance) { 94 99 die('function WP_Widget::widget() must be over-ridden in a sub-class.'); … … 96 101 97 102 /** 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 */ 100 111 function update($new_instance, $old_instance) { 101 112 return $new_instance; 102 113 } 103 114 104 /** Echo a control form for the current instance. */ 115 /** Echo the settings update form 116 * 117 * @param array $instance Current settings 118 */ 105 119 function form($instance) { 106 120 echo '<p>' . __('There are no options for this widget.') . '</p>'; … … 135 149 } 136 150 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 */ 139 158 function get_field_name($field_name) { 140 159 return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']'; 141 160 } 142 161 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 */ 145 169 function get_field_id($field_name) { 146 170 return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name; 147 171 } 148 172 149 / ** Registers this widget-type.150 * Called during the 'widgets_init' action. */ 173 // Private Functions. Don't worry about these. 174 151 175 function _register() { 152 176 $settings = $this->get_settings(); … … 166 190 } 167 191 } 168 169 // Private Functions. Don't worry about these.170 192 171 193 function _set($number) {
Note: See TracChangeset
for help on using the changeset viewer.