[wp-trac] Re: [WordPress Trac] #8441: Add "MultiWidget" Class for
Plugin Development
WordPress Trac
wp-trac at lists.automattic.com
Sun Mar 15 00:20:31 GMT 2009
#8441: Add "MultiWidget" Class for Plugin Development
-------------------------+--------------------------------------------------
Reporter: thornomad | Owner: azaozz
Type: enhancement | Status: new
Priority: normal | Milestone: 2.8
Component: Widgets | Version: 2.8
Severity: normal | Keywords: widget, plugin, multi-widget
-------------------------+--------------------------------------------------
Changes (by scribu):
* milestone: 2.9 => 2.8
Comment:
Great to see this made it into 2.8
However, since the class can't be used by itself, wouldn't it be better to
rename the constructor setup() ?
Another alternative would be to make setup() another method that needs to
be overritten.
Thus, instead of
{{{
class WP_Widget_Pages extends WP_Widget {
function WP_Widget_Pages() {
$widget_ops = array('classname' => 'widget_pages',
'description' => __( "Your blog's WordPress Pages") );
$this->WP_Widget('pages', __('Pages'), $widget_ops);
}
}}}
we would have something much cleaner:
{{{
class WP_Widget_Pages extends WP_Widget {
function setup() {
$this->id_base = 'pages';
$this->name = __('Pages');
$this->widget_ops = array('classname' => 'widget_pages',
'description' => __( "Your blog's WordPress Pages") );
}
}}}
setup() would be called form the WP_Widget constructor.
I'll write a patch for it if there are no objections.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/8441#comment:14>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list