class Widget extends WP_Widget

Properties

string $id_base Base ID for the widget, lower case, if left empty a portion of the widget's class name will be used. Has to be unique.
string $name Name for the widget displayed on the configuration page.
array $widget_options Optional. Passed to wp_register_sidebar_widget()
array $control_options Optional. Passed to wp_register_widget_control()
protected $plugin An instance of plugin.

Methods

__construct(string $plugin)

Widget constructor.

array
defaults()

Return a key pairs array with the default value for widget.

widget(array $args, array $instance)

Echo the widget content.

viewWidget(array $args, array $instance)

Return the view resource path. eg: "widget.demo".

void
form(array $instance)

Echo the settings update form

string
viewForm($instance)

Return the view resource path. eg: "widget.form".

Details

at line 59
__construct(string $plugin)

Widget constructor.

Parameters

string $plugin

at line 71
abstract array defaults()

Return a key pairs array with the default value for widget.

Return Value

array

at line 80
widget(array $args, array $instance)

Echo the widget content.

Subclasses should over-ride this function to generate their widget code.

Parameters

array $args Display arguments including before_title, after_title, before_widget, and after_widget.
array $instance The settings for the particular instance of the widget

at line 102
abstract viewWidget(array $args, array $instance)

Return the view resource path. eg: "widget.demo".

Parameters

array $args Display arguments including before_title, after_title, before_widget, and after_widget.
array $instance The settings for the particular instance of the widget

at line 111
void form(array $instance)

Echo the settings update form

Parameters

array $instance Current settings

Return Value

void

at line 122
abstract string viewForm($instance)

Return the view resource path. eg: "widget.form".

Parameters

$instance

Return Value

string