API / Minn\Rest / WidgetObject

WidgetObject final readonly class

Minn\Rest\WidgetObject · public/minn/src/Minn/Rest/WidgetObject.php · 55 lines

A widget as wp/v2/widgets shows it (probe rest-widgets): its id and base, its sidebar, its markup as that sidebar wraps it (nothing among the inactive widgets) and, in the edit context, its settings form and its settings: serialized and base64 encoded, signed with wp_hash, and raw when the widget shows its instance in REST. Links to itself, its type and its sidebar; through rest_prepare_widget.

Constants and properties

privatereadonly Minn\Rest\RestUrl $url

Promoted from the constructor.

Public

new__construct(Minn\Rest\RestUrl $url)#
methodview(string $widgetId, string $sidebarId, Minn\Rest\Context $context): array#

A widget in a sidebar, its form and settings in the edit context. @return array<string, mixed>

@return array<string, mixed>
staticinstance(Minn\Objects\Widget $object, int $number): array#

A widget's settings, encoded and signed, and raw when it shows them. @return array<string, mixed>

@return array<string, mixed>

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateform(Minn\Objects\Widget $object, int $number): string#