\Hazaar\View\Widgets
Widget
Abstract

Base widget class

Tags

Since

1.0.0

Summary
Methods Properties Constants
add
get
set
val
No constants
Properties
$element
$element
$events
$events
$jquery
$jquery
$name
$name
$properties
$properties
$rendered
$rendered
$script
$script
Methods
__construct()
__construct($type, $name, $params = Array ( ) , $inline = false, $content = null)

Widget base constructor.

Parameters

$typestring

The type of HTML element to use, such as DIV or INPUT.

$name

No description

$paramsarray

Extra params to set on the HTML element.

$inline\Hazaar\View\Widgets\bool

Whether or not the element should be inline or block.

$contentmixed

Any content that should go inside an inline block.

add()
add()
attr()
attr($key, $value = null) : \Hazaar\View\Widgets\Widget

Set an attribute on the HTML element part of the Widget. This differs from Widget::set() as that method sets parameters that are sent to the jqWidgets library. This method sets parameters on the HTML element that will be turned into the Widget (usually a DIV or INPUT).

Parameters

$key

No description

$value

No description

Returns

\Hazaar\View\Widgets\Widget

A reference to the current object.

call()
call($method) : \Hazaar\View\Widgets\Widget

Like method(), except this will call an actual method on the object. Useful for calling built-in on other jQuery methods such as val().

Parameters

$method

No description

Returns

\Hazaar\View\Widgets\Widget
destroy()
destroy() : string

Execute the destroy method on a widget

Returns

string

JavaScript code to execute the destroy method.

disable()
disable() : string

This method disables the widget.

Returns

string
disabled()
disabled($value) : \Hazaar\View\Widgets\Widget

Sets whether the widget is disabled by default or not.

Parameters

$value\Hazaar\View\Widgets\bool

True to disable, false to not.

Returns

\Hazaar\View\Widgets\Widget

A reference to the current object.

enable()
enable() : string

This method enabled the widget.

Returns

string
event()
event($name, $code) : \Hazaar\View\Widgets\Widget

Add an event to the Widget

Parameters

$namestring

The name of the event. eg: ‘click’

$codemixed

The JavaScript code to execute either as a string or a JavaScript object.

Returns

\Hazaar\View\Widgets\Widget
exec()
exec($script)

Parameters

$script

No description

focus()
focus() : string

Execute the focus method on a widget

Returns

string

JavaScript code to execute the focus method.

get()
get($key) : mixed

Gets a widget property that has already been set

Parameters

$keystring

The property to return

Returns

mixed
height()
height($value) : \Hazaar\View\Widgets\Widget

Specifies the height of the widget in pixels.

Parameters

$valuemixed

The height value. Either an integer or string (with px suffix);

Returns

\Hazaar\View\Widgets\Widget

A reference to the current object.

method()
method($name) : \Hazaar\View\Widgets\Widget

Call a jqWidgets method using the jqWidgets interface. Methods are called using this interface by specifying the first argument as the method being called and subsequent arguments are the actual arguments for the method call.

Parameters

$namestring

The method to call.

Returns

\Hazaar\View\Widgets\Widget
name()
name() : string

Returns the name of the object class. This is used to generate the jqxWidget plugin method name.

Returns

string
onClick()
onClick($value) : \Hazaar\View\Widgets\Widget

Adds a click event to a widget

Parameters

$valuemixed

The code as a string or JavaScript object, or array of objects to execute.

Returns

\Hazaar\View\Widgets\Widget
render()
render() : string

Execute the render method on a widget

Returns

string

JavaScript code to execute the render method.

renderObject()
renderObject() : string

Method to render the widget into HTML.

Returns

string

The widget rendererd as HTML.

reset()
reset()
set()
set($key, $value = null, $type = null) : \Hazaar\View\Widgets\Widget

Sets a parameter that is sent to the DOM object.

This method can be used to set a single parameter, with the $key and $value arguments, or multiple parameters by just using the $key argument which is an array of key/value pairs of parameters that are to be set.

Parameters

$keymixed

The name of the parameter to be set, or an array of key/value pairs listing multiple parameters to be set.

$valuemixed

(Optional) The value of the parameter if only specifying one parameter.

$typestring

(Optional) The data type of the value. If set then this will be set explicitly.

Returns

\Hazaar\View\Widgets\Widget

A reference to the current object.

setContent()
setContent($content) : string

Sets or gets the value.

Parameters

$content

No description

Returns

string
style()
style($value)

Parameters

$value

No description

theme()
theme($value) : \Hazaar\View\Widgets\Widget

Specifies the theme to use when initialising the widget. This is not normally needed as the default theme is set when creating each widget. However you may want to override the theme on a per widget basis and this allows for that.

Keep in mind that the theme file used will have to included manually.

Parameters

$valuestring

The name of the theme.

Returns

\Hazaar\View\Widgets\Widget

A reference to the current object.

val()
val($value = null) : string

Sets or gets the value.

Parameters

$valuestring

The value to set

Returns

string
width()
width($value) : \Hazaar\View\Widgets\Widget

Specifies the width of the widget in pixels.

Parameters

$valuemixed

The width value. Either an integer or string (with px suffix);

Returns

\Hazaar\View\Widgets\Widget

A reference to the current object.