Ticket #9651: widgets.php.diff
File widgets.php.diff, 2.1 KB (added by , 16 years ago) |
---|
-
widgets.php
164 164 $this->_set( $widget_args['number'] ); 165 165 $settings = $this->get_settings(); 166 166 167 if ( array_key_exists( $this->number, $settings ) ) 168 $this->widget($args, $settings[$this->number]); 167 if ( array_key_exists( $this->number, $settings ) ) { 168 $hide_widget = apply_filters('widget_display_test', $this); //Add hook to test if widget should be displayed. Sends the widget object as a variable. If the call returns ***false*** the widget will not be displayed. 169 if (!$hide_widget) $this->widget($args, $settings[$this->number]); //Test and display widget. 170 } 169 171 } 170 172 171 173 /** Deal with changed settings. … … 222 224 else 223 225 $instance = $this->update($new_instance, array()); 224 226 225 if ( false !== $instance ) 226 $all_instances[$number] = $instance; 227 if ( false !== $instance ) { 228 $widget_options_compare = array($new_instance,$instance); //This array is used to compare the intended instance values (sent iva _POST) with the values overridden by the $this->update function. 229 $instance = apply_filters('default_widget_options_update',$widget_options_compare, $this); //Callback to apply default and/or other options/instance values to be added to list of widget options/values to store in database. Should return widget options/values as array to be updated. 230 $all_instances[$number] = $instance; 231 } 227 232 } 228 233 } 229 234 … … 250 255 $instance = $all_instances[ $widget_args['number'] ]; 251 256 } 252 257 253 return $this->form($instance); 258 $this->form($instance); 259 260 do_action('default_widget_options_display', $this); //Add action hook to display default widget information or options. Sends the widget object as a variable. Anything output by the called function will be displayed below the widget options set by the form function. 254 261 } 255 262 256 263 /** Helper function: Registers a single instance. */