Documentation

WP_Backstage_Widget_Base extends WP_Widget
in package

WP Backstage Widget Base

Sets up a global widget that all WP Backstage widgets use as their base by adding hooks and filters for the form, the output, and saving of instances.

Tags
since
2.0.0
since
2.2.0

Added before_widget and after_widget args to widget method.

Table of Contents

$args  : array<string|int, mixed>
Args
$slug  : array<string|int, mixed>
Slug
__construct()  : void
Construct
form()  : mixed
Form
update()  : mixed
Update
widget()  : mixed
Widget

Properties

Methods

__construct()

Construct

public __construct([string $slug = '' ][, array<string|int, mixed> $args = array() ]) : void

Constructs the widget and calls the parent widgets constructor.

Parameters
$slug : string = ''

The widget's slug.

$args : array<string|int, mixed> = array()

The widget's args.

Tags
since
2.0.0
Return values
void

form()

Form

public form(array<string|int, mixed> $instance) : mixed

This is the function that renders the "back end" of the widget. It adds an action for WP Backstage to render the form fields. This allows for this class to be used for all WP Backstage widgets.

Parameters
$instance : array<string|int, mixed>

The stored settings of this widget instance.

Tags
since
2.0.0
Return values
mixed

update()

Update

public update(array<string|int, mixed> $new_instance, array<string|int, mixed> $old_instance) : mixed

This is the function that saves the instance of the widget. It adds a filter for WP Backstage to save the form fields, passing the new instance and old instance. This allows for this class to be used for all WP Backstage widgets.

Parameters
$new_instance : array<string|int, mixed>

The new settings to store.

$old_instance : array<string|int, mixed>

The currentylu stored settings.

Tags
since
2.0.0
Return values
mixed

widget()

Widget

public widget(array<string|int, mixed> $args, array<string|int, mixed> $instance) : mixed

This is the function that renders the "front end" of the widget. It outputs the before_widget and after_widget args, and adds an action for the developer to render the front end. This allows for this class to be used for all WP Backstage widgets.

Parameters
$args : array<string|int, mixed>

The arguments of the widget as configured when registering the widget area.

$instance : array<string|int, mixed>

The stored settings of this widget instance.

Tags
since
2.0.0
Return values
mixed

Search results