AbstractWidget
extends WP_Widget
in package
Tags
Table of Contents
- $fields : array<string|int, AbstractField>
- __construct() : mixed
- filterArgs() : array<string|int, mixed>
- Filters the widget's settings before displaying it on the frontend.
- form() : mixed
- Backend view of the widget.
- getDescription() : string
- getId() : string
- getName() : string
- load() : mixed
- register() : mixed
- update() : array<string|int, mixed>
- Sanitize widget form values as they are saved.
- widget() : mixed
- Frontend view of the widget.
- addActions() : mixed
- filterWidgetArgs() : mixed
- getFields() : array<string|int, mixed>
- renderContent() : string
- renderForm() : string
Properties
$fields
public
array<string|int, AbstractField>
$fields
= []
Tags
Methods
__construct()
public
__construct([array<string|int, mixed> $widgetOptions = [] ]) : mixed
Parameters
- $widgetOptions : array<string|int, mixed> = []
-
Optional.
Tags
Return values
mixed —filterArgs()
Filters the widget's settings before displaying it on the frontend.
public
filterArgs(array<string|int, mixed> $instanceArgs, WP_Widget $widget) : array<string|int, mixed>
Returning false will effectively short-circuit display of the widget.
Parameters
- $instanceArgs : array<string|int, mixed>
- $widget : WP_Widget
-
The widget instance.
Tags
Return values
array<string|int, mixed> —form()
Backend view of the widget.
public
form(array<string|int, mixed> $instanceArgs) : mixed
Parameters
- $instanceArgs : array<string|int, mixed>
-
Previously saved parameters from the database.
Tags
Return values
mixed —getDescription()
public
getDescription() : string
Tags
Return values
string —getId()
public
abstract getId() : string
Tags
Return values
string —Unprefixed ID for the widget, lowercase and unique.
getName()
public
abstract getName() : string
Tags
Return values
string —Name for the widget displayed on the configuration page.
load()
public
load() : mixed
Tags
Return values
mixed —register()
public
register() : mixed
Tags
Return values
mixed —update()
Sanitize widget form values as they are saved.
public
update(array<string|int, mixed> $newValues, array<string|int, mixed> $oldValues) : array<string|int, mixed>
Parameters
- $newValues : array<string|int, mixed>
-
Values just sent to be saved.
- $oldValues : array<string|int, mixed>
-
Previously saved values from database.
Tags
Return values
array<string|int, mixed> —Values to be saved.
widget()
Frontend view of the widget.
public
widget(array<string|int, mixed> $widgetArgs, array<string|int, mixed> $instanceArgs) : mixed
Parameters
- $widgetArgs : array<string|int, mixed>
-
Widget args.
- $instanceArgs : array<string|int, mixed>
-
Saved parameters from the database.
Tags
Return values
mixed —addActions()
protected
addActions() : mixed
Tags
Return values
mixed —filterWidgetArgs()
protected
filterWidgetArgs(array<string|int, mixed> $widgetArgs[, array<string|int, mixed> $instanceArgs = [] ]) : mixed
Parameters
- $widgetArgs : array<string|int, mixed>
-
Widget args: before_widget, after_widget, before_title, after_title.
- $instanceArgs : array<string|int, mixed> = []
-
Optional. Saved parameters from the database.
Tags
Return values
mixed —getFields()
protected
abstract getFields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —renderContent()
protected
abstract renderContent(array<string|int, mixed> $instanceArgs) : string
Parameters
- $instanceArgs : array<string|int, mixed>
-
Saved parameters from the database.
Tags
Return values
string —renderForm()
protected
renderForm() : string