Make WordPress Core


Ignore:
Timestamp:
05/02/2009 12:21:16 AM (16 years ago)
Author:
azaozz
Message:

Add action "in_widget_form" allowing plugins to add extra fields, don't show "Save" button if a widget doesn't have settings form, fixes #9651

File:
1 edited

Legend:

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

    r11134 r11155  
    6666    function form($instance) {
    6767        echo '<p>' . __('There are no options for this widget.') . '</p>';
    68         return false;
     68        return 'noform';
    6969    }
    7070
     
    260260        // filters the widget admin form before displaying, return false to stop displaying it
    261261        $instance = apply_filters('widget_form_callback', $instance, $this);
    262         if ( false !== $instance )
    263             $this->form($instance);
     262
     263        $return = null;
     264        if ( false !== $instance ) {
     265            $return = $this->form($instance);
     266            if ( 'noform' !== $return )
     267                do_action_ref_array( 'in_widget_form', array(&$this) ); // add extra fields in the widget form
     268        }
     269        return $return;
    264270    }
    265271
Note: See TracChangeset for help on using the changeset viewer.