Neuron-PHP

Widget
in package
implements IWidget

AbstractYes

Abstract base class for widgets.

Provides helper methods for common widget operations.

Table of Contents

Interfaces

IWidget
Widget interface for extensible shortcode/widget system.

Methods

getAttributes()  : array<string|int, mixed>
Get supported attributes (override if needed)
getDescription()  : string
Get widget description (override if needed)
attr()  : mixed
Helper to get attribute with default value
sanitizeHtml()  : string
Sanitize HTML to prevent XSS
view()  : string
Helper to render a view template

Methods

getAttributes()

Get supported attributes (override if needed)

public getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of [attribute => description]

getDescription()

Get widget description (override if needed)

public getDescription() : string
Return values
string

Widget description

attr()

Helper to get attribute with default value

protected attr(array<string|int, mixed> $attrs, string $key[, mixed $default = null ]) : mixed
Parameters
$attrs : array<string|int, mixed>

Attributes array

$key : string

Attribute key

$default : mixed = null

Default value

sanitizeHtml()

Sanitize HTML to prevent XSS

protected sanitizeHtml(string $html) : string
Parameters
$html : string
Return values
string

view()

Helper to render a view template

protected view(string $template[, array<string|int, mixed> $data = [] ]) : string
Parameters
$template : string

Template file path

$data : array<string|int, mixed> = []

Data to extract into template scope

Return values
string

Rendered output


        
On this page

Search results