Blesta Source Documentation

Widget extends AbstractWidget

Simplifies the creation of widget interfaces

Table of Contents

Properties

$ajax_filtering
$eol
$filter_html
$filter_uri
$filters
$header_link
$link_buttons
$nav
$nav_type
$render
$return_output
$show_filters
$style_sheets
$widget_buttons
$badge_uri
$badge_value
$widget_buttons_map

Methods

__construct() Initializes the widget helper
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
setAjaxFiltering() Sets whether to submit filters and reload widget via ajax
setBadgeUri() Sets the URI to request when fetching a badge value for this widget
setBadgeValue() Sets the badge value to appear on this widget, any thing other than null will be displayed
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
setRow() Sets a row for this widget to be displayed.
setStyleSheet() Sets a style sheet to be linked into the document
setTabs() Sets navigation tabs within the widget
setWidgetButton() Set a widget button to be displayed in the title bar of the widget
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
buildBadge() Creates the badge value to appear next to the title of the widget
buildFilter() Build the filter input/label/tooltips for a given field
buildFilters() Builds the filter form for this widget
buildIcon() Creates a font awesome icon from the given class
buildIcons() Creates font awesome icons for widget buttons
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

protected string $header_link = ''

The widget header link

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

$badge_uri

private string $badge_uri = \null

The URI to fetch when requesting the badge value for this widget

$badge_value

private string $badge_value = \null

The badge value to display for this widget

$widget_buttons_map

private array<string|int, mixed> $widget_buttons_map = ['filter-toggle' => ['default' => 'fas fa-filter', 'toggled' => 'fas fa-filter'], 'arrow' => ['default' => 'fas fa-caret-up', 'toggled' => 'fas fa-caret-down'], 'setting' => ['default' => 'fas fa-cog', 'toggled' => 'fas fa-cog'], 'full_screen' => ['default' => 'fas fa-expand-arrows-alt', 'toggled' => 'fas fa-compress-arrows-alt']]

Mapping for widget button classes to their font awesome icons

Methods

__construct()

Initializes the widget helper

public __construct() : mixed

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
  • content_section The full content including nav (everything excluding box frame and title section)
  • common_box_content The content only (full_content excluding the nav)
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

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

setBadgeUri()

Sets the URI to request when fetching a badge value for this widget

public setBadgeUri(string $uri) : mixed
Parameters
$uri : string

The URI to request for the badge value for this widget

setBadgeValue()

Sets the badge value to appear on this widget, any thing other than null will be displayed

public setBadgeValue([string $value = null ]) : mixed
Parameters
$value : string = null

The value of the badge to be displayed

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

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'=>"#"))

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

setRow()

Sets a row for this widget to be displayed.

public setRow([string $left = null ][, string $right = null ]) : mixed
Parameters
$left : string = null

An HTML string to set on the left of the row

$right : string = null

An HTML string to set on the right of the row

Return values
mixed

An HTML string containing the row, void if the string is output automatically

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

setTabs()

Sets navigation tabs within the widget

public setTabs(array<string|int, mixed> $tabs) : mixed
Parameters
$tabs : array<string|int, mixed>

A multi-dimensional array of tab info including:

  • name The name of the tab to be displayed
  • current True if this element is currently active
  • attributes An array of attributes to set for this tab (e.g. array('href'=>"#"))

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

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

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

buildBadge()

Creates the badge value to appear next to the title of the widget

private buildBadge() : string
Return values
string

An HTML string containing the badge value

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

buildFilters()

Builds the filter form for this widget

private buildFilters() : string
Return values
string

Html for the widget filtering form

buildIcon()

Creates a font awesome icon from the given class

private buildIcon(string $class) : string
Parameters
$class : string

The class name(s) for an icon

Return values
string

An HTML string containing the icon

buildIcons()

Creates font awesome icons for widget buttons

private buildIcons(string $class) : string
Parameters
$class : string

The class name(s) for a single button

Return values
string

An HTML string containing the icons

buildLinkButtons()

Builds link buttons for use with link navigation

private buildLinkButtons() : string
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

Tags
subpackage

helpers.widget

copyright

Copyright (c) 2010, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results