WidgetClient extends AbstractWidget
Simplifies the creation of widgets for the client interface
Table of Contents
Properties
Methods
| __construct() | Initializes the client widget helper |
| autoStartBody() | Sets whether or not the body panel should start when WidgetClient::create() is called |
| buildFilters() | Builds the filter form for this widget |
| clear() | Clear this widget, making it ready to produce the next widget |
| create() | Creates the widget with the given title and attributes |
| end() | End the widget, closing an loose ends |
| endBody() | End the widget body |
| endFooter() | End the widget footer |
| setAjaxFiltering() | Sets whether to submit filters and reload widget via ajax |
| setFilterHtml() | Sets HTML for the widget filtering form |
| setFilters() | Sets a list of widget filters |
| setHeaderLink() | Sets the link for the widget header |
| setLinkButtons() | Sets navigation buttons along with AbstractWidget::setLinks(). This method may only be used in addition with AbstractWidget::setLinks() |
| setLinks() | Sets navigation links within the widget |
| setOutput() | Set whether to return $output generated by these methods, or to echo it out instead |
| setStyleSheet() | Sets a style sheet to be linked into the document |
| setWidgetButton() | Set a widget button to be displayed in the title bar of the widget |
| startBody() | Start the widget body |
| startFooter() | Start the widget footer |
| output() | Handles whether to output or return $html |
| setFilterLink() | Add the filter form toggle button to the list of widget links |
| ajaxFilteringHtml() | Get the html/js for submitting filtering forms via ajax |
| buildFilter() | Build the filter input/label/tooltips for a given field |
| buildLinkButtons() | Builds link buttons for use with link navigation |
| buildNav() | Builds the nav for this widget |
| buildNavElements() | Builds the nav elements for this widget |
| buildStyleSheets() | Builds the markup to link style sheets into the DOM using jQuery |
| buildWidgetButtons() | Creates the window buttons that appear in the title bar of the widget |
Properties
$ajax_filtering
protected
bool
$ajax_filtering
Whether to submit filters and reload widget via ajax
$eol
protected
string
$eol
= "\n"
The string to use as the end of line character, "\n" by default
$filter_html
protected
string
$filter_html
= ''
The HTML to display either in or as the widget filtering form
$filter_uri
protected
string
$filter_uri
= ''
The uri to which the widget filtering form should be submitted
$filters
protected
InputFilters
$filters
A list of input fields to display in the widget filtering form
$header_link
protected
string
$header_link
= ''
The widget header link
$link_buttons
protected
array<string|int, mixed>
$link_buttons
= []
An array of link buttons
$nav
protected
array<string|int, mixed>
$nav
= []
An array of navigation elements
$nav_type
protected
string
$nav_type
= 'links'
Sets the navigation type:
- links
- tabs
- pills
$render
protected
string
$render
How to render the widget. Options include:
- full The entire widget (default)
- inner The content only (everything excluding the nav and title)
- content_section The full content including nav (everything exluding box frame and title section)
- common_box_content The content only (full_content excluding the nav)
$return_output
protected
bool
$return_output
= false
Whether or not to return output from various widget methods
$show_filters
protected
bool
$show_filters
Whether to show the filter content on page load
$style_sheets
protected
array<string|int, mixed>
$style_sheets
= []
An array of style sheet attributes to be rendered into the DOM
$widget_buttons
protected
array<string|int, mixed>
$widget_buttons
= []
Buttons that should be displayed within the window
$auto_start_body
private
bool
$auto_start_body
= \false
True if to automatically start the widget body
$body_open
private
bool
$body_open
= \false
True if the body of the widget is open
$footer_open
private
bool
$footer_open
= \false
True if the footer of the widget is open
Methods
__construct()
Initializes the client widget helper
public
__construct() : mixed
autoStartBody()
Sets whether or not the body panel should start when WidgetClient::create() is called
public
autoStartBody(bool $auto_start) : mixed
Parameters
- $auto_start : bool
-
True to auto begin the widget body when WidgetClient::create() is called
buildFilters()
Builds the filter form for this widget
public
buildFilters([bool $output = true ]) : string
Parameters
- $output : bool = true
-
True to output the body, false to return it
Return values
string —Html for the widget filtering form
clear()
Clear this widget, making it ready to produce the next widget
public
clear() : mixed
create()
Creates the widget with the given title and attributes
public
create([string $title = null ][, array<string|int, mixed> $attributes = null ][, string $render = null ]) : mixed
Parameters
- $title : string = null
-
The title to display for this widget
- $attributes : array<string|int, mixed> = null
-
An list of attributes to set for this widget's primary container
- $render : string = null
-
How to render the widget. Options include:
- full The entire widget (default)
- inner_content (everything but the title)
Return values
mixed —An HTML string containing the widget, void if the string is output automatically
end()
End the widget, closing an loose ends
public
end() : mixed
Return values
mixed —An HTML string ending the widget, void if the string is output automatically
endBody()
End the widget body
public
endBody([bool $output = true ]) : mixed
Parameters
- $output : bool = true
-
True to output the body, false to return it
Return values
mixed —An HTML string ending the widget body, void if the string is output automatically
endFooter()
End the widget footer
public
endFooter([bool $output = true ]) : mixed
Parameters
- $output : bool = true
-
True to output the footer, false to return it
Return values
mixed —An HTML string ending the widget footer, void if the string is output automatically
setAjaxFiltering()
Sets whether to submit filters and reload widget via ajax
public
setAjaxFiltering([bool $ajax = true ]) : mixed
Parameters
- $ajax : bool = true
-
Whether to submit filters and reload widget via ajax
setFilterHtml()
Sets HTML for the widget filtering form
public
setFilterHtml(string $html[, bool $show_filters = false ]) : mixed
Parameters
- $html : string
-
The uri for the widget filtering form action
- $show_filters : bool = false
-
Whether to show the filtering form on page load
setFilters()
Sets a list of widget filters
public
setFilters(InputFields $filters, string $uri[, bool $show_filters = false ]) : mixed
Parameters
- $filters : InputFields
-
A list of input fields to display in the widget filtering form
- $uri : string
-
The uri for the widget filtering form action
- $show_filters : bool = false
-
Whether to show the filtering form on page load
setHeaderLink()
Sets the link for the widget header
public
setHeaderLink(string $link) : mixed
Parameters
- $link : string
-
The link for the widget header
setLinkButtons()
Sets navigation buttons along with AbstractWidget::setLinks(). This method may only be used in addition with AbstractWidget::setLinks()
public
setLinkButtons(array<string|int, mixed> $link_buttons) : mixed
Parameters
- $link_buttons : array<string|int, mixed>
-
A multi-dimensional array of button links including:
- name The name of the button link to be displayed
- icon The class name of the icon to display before the name
- attributes An array of attributes to set for this button link (e.g. array('href'=>"#"))
setLinks()
Sets navigation links within the widget
public
setLinks(array<string|int, mixed> $link[, string $type = 'links' ]) : mixed
Parameters
- $link : array<string|int, mixed>
-
A multi-dimensional array of tab info including:
- name The name of the link to be displayed
- current True if this element is currently active
- attributes An array of attributes to set for this link (e.g. array('href'=>"#"))
- $type : string = 'links'
-
the type of links being set (optional) (links or tabs, default links)
setOutput()
Set whether to return $output generated by these methods, or to echo it out instead
public
setOutput(bool $return) : mixed
Parameters
- $return : bool
-
True to return output from these widget methods, false to echo results instead
setStyleSheet()
Sets a style sheet to be linked into the document
public
setStyleSheet(string $path[, array<string|int, mixed> $attributes = null ]) : mixed
Parameters
- $path : string
-
the web path to the style sheet
- $attributes : array<string|int, mixed> = null
setWidgetButton()
Set a widget button to be displayed in the title bar of the widget
public
setWidgetButton(string|array<string|int, mixed> $button) : mixed
Parameters
- $button : string|array<string|int, mixed>
-
The widget button attributes
startBody()
Start the widget body
public
startBody([bool $output = true ]) : mixed
Parameters
- $output : bool = true
-
True to output the body, false to return it
Return values
mixed —An HTML string beginning the widget body, void if the string is output automatically
startFooter()
Start the widget footer
public
startFooter([bool $output = true ]) : mixed
Parameters
- $output : bool = true
-
True to output the footer, false to return it
Return values
mixed —An HTML string beginning the widget footer, void if the string is output automatically
output()
Handles whether to output or return $html
protected
output(string $html) : string
Parameters
- $html : string
-
The HTML to output/return
Return values
string —The HTML given, void if output enabled
setFilterLink()
Add the filter form toggle button to the list of widget links
protected
setFilterLink() : mixed
ajaxFilteringHtml()
Get the html/js for submitting filtering forms via ajax
private
ajaxFilteringHtml() : string
Return values
string —The ajax html/js
buildFilter()
Build the filter input/label/tooltips for a given field
private
buildFilter(InputField $field) : string
Parameters
- $field : InputField
-
The InputField to build from
Return values
string —The html for the input field
buildLinkButtons()
Builds link buttons for use with link navigation
private
buildLinkButtons([array<string|int, mixed> $attributes = null ]) : string
Parameters
- $attributes : array<string|int, mixed> = null
-
A set of link button HTML attributes (optional)
Return values
string —A string of HTML
buildNav()
Builds the nav for this widget
private
buildNav() : mixed
Return values
mixed —A string of HTML, or void if HTML is output automatically
buildNavElements()
Builds the nav elements for this widget
private
buildNavElements() : string
Return values
string —A string of HTML
buildStyleSheets()
Builds the markup to link style sheets into the DOM using jQuery
private
buildStyleSheets() : string
Return values
string —A string of HTML
buildWidgetButtons()
Creates the window buttons that appear in the title bar of the widget
private
buildWidgetButtons() : string
Return values
string —An HTML string containing the window buttons