htmlResponsiveInputCheckbox
extends htmlInputCheckbox
in package
Responsive checkbox with descriptive label and help link.
Table of Contents
- ALIGN_BOTTOM = 3
- align to bottom
- ALIGN_CENTER = 4
- align to center
- ALIGN_LEFT = 1
- align to left
- ALIGN_RIGHT = 2
- align to right
- ALIGN_TOP = 0
- align to top
- $alignment : int|null
- alignment when inside a table
- $colspan : int|null
- colspan if inside a table
- $rowspan : int|null
- rowspan if inside a table
- $checked : bool
- value
- $cssClasses : array<string|int, mixed>|null
- $elementsToDisable : array<string|int, mixed>
- $elementsToEnable : array<string|int, mixed>
- $isEnabled : bool
- enabled or disabled
- $name : string
- unique name of input element
- $tableCellCssClasses : array<string|int, mixed>|null
- $tableRowsToHide : array<string|int, mixed>
- $tableRowsToShow : array<string|int, mixed>
- $accessibilityLabel : string|null
- accessibility label
- $dataAttributes : array<string|int, mixed>
- $helpID : string|null
- help ID
- $helpModule : string|null
- help module name
- $label : string
- descriptive label
- $labelAfterCheckbox : bool
- label after checkbox
- $longLabel : bool
- long label
- $onClick : string|null
- onclick event code
- $renderParentHtml : bool
- render HTML of parent class
- $shortLabel : bool
- short label
- $title : string|null
- title
- $transient : bool
- indicates that this field should not automatically be saved in the self-service or server profile
- __construct() : mixed
- Constructor.
- addDataAttribute() : void
- Adds a data attribute.
- generateHTML() : array<string, string>
- Prints the HTML code for this element.
- getAccessibilityMarkup() : string
- Returns the markup for the accessibility data.
- getAlignmentString() : string
- Returns the HTML attributes for the alignment.
- getColspanString() : string
- Returns the HTML attribute for the colspan.
- getCSSClasses() : array<string|int, string>|null
- Returns the CSS classes of this element.
- getRowspanString() : string
- Returns the HTML attribute for the rowspan.
- getTableCellCSSClasses() : array<string|int, string>|null
- Returns the CSS classes of the surrounding table cell for this element.
- setAccessibilityLabel() : void
- Sets the accessibility label.
- setCSSClasses() : void
- Adds CSS classes to this element.
- setElementsToDisable() : void
- This will disable the given input elements when the checkbox is checked.
- setElementsToEnable() : void
- This will enable the given input elements when the checkbox is checked.
- setIsEnabled() : void
- Specifies if this component is enabled and accepts user modification.
- setLabelAfterCheckbox() : void
- Sets if the label should be shown after the checkbox instead before it.
- setOnClick() : void
- Sets the onclick code.
- setShortLabel() : void
- Use a short label (4 columns instead of 6) for tablet/desktop.
- setTableCellCSSClasses() : void
- Adds CSS classes to the surrounding table cell for this element.
- setTableRowsToHide() : void
- This will hide the given table rows when the checkbox is checked.
- setTableRowsToShow() : void
- This will show the given table rows when the checkbox is checked.
- setTitle() : void
- Sets the title.
- setTransient() : void
- Specifies that the value should not be automatically saved when used in self-service or server profile (default: false).
- getDataAttributesAsString() : string
- Returns the data attributes as rendered string.
- getName() : string
- Returns the checkbox name.
- getShowHideSelector() : string
- Returns the CSS selector to use to find show/hide elements.
Constants
ALIGN_BOTTOM
align to bottom
public
mixed
ALIGN_BOTTOM
= 3
ALIGN_CENTER
align to center
public
mixed
ALIGN_CENTER
= 4
ALIGN_LEFT
align to left
public
mixed
ALIGN_LEFT
= 1
ALIGN_RIGHT
align to right
public
mixed
ALIGN_RIGHT
= 2
ALIGN_TOP
align to top
public
mixed
ALIGN_TOP
= 0
Properties
$alignment
alignment when inside a table
public
int|null
$alignment
= \null
$colspan
colspan if inside a table
public
int|null
$colspan
= \null
$rowspan
rowspan if inside a table
public
int|null
$rowspan
= \null
$checked
value
protected
bool
$checked
$cssClasses
protected
array<string|int, mixed>|null
$cssClasses
= []
CSS classes
$elementsToDisable
protected
array<string|int, mixed>
$elementsToDisable
= []
list of input elements to disable when checked
$elementsToEnable
protected
array<string|int, mixed>
$elementsToEnable
= []
list of input elements to enable when checked
$isEnabled
enabled or disabled
protected
bool
$isEnabled
= \true
$name
unique name of input element
protected
string
$name
$tableCellCssClasses
protected
array<string|int, mixed>|null
$tableCellCssClasses
= []
table cell CSS classes
$tableRowsToHide
protected
array<string|int, mixed>
$tableRowsToHide
= []
list of enclosing table rows to hide when checked
$tableRowsToShow
protected
array<string|int, mixed>
$tableRowsToShow
= []
list of enclosing table rows to show when checked
$accessibilityLabel
accessibility label
private
string|null
$accessibilityLabel
= \null
$dataAttributes
private
array<string|int, mixed>
$dataAttributes
= []
data attributes
$helpID
help ID
private
string|null
$helpID
= \null
$helpModule
help module name
private
string|null
$helpModule
= \null
$label
descriptive label
private
string
$label
$labelAfterCheckbox
label after checkbox
private
bool
$labelAfterCheckbox
= \false
$longLabel
long label
private
bool
$longLabel
$onClick
onclick event code
private
string|null
$onClick
= \null
$renderParentHtml
render HTML of parent class
private
bool
$renderParentHtml
= \false
$shortLabel
short label
private
bool
$shortLabel
= \false
$title
title
private
string|null
$title
= \null
$transient
indicates that this field should not automatically be saved in the self-service or server profile
private
bool
$transient
= \false
Methods
__construct()
Constructor.
public
__construct(string $name, bool $checked, string $label[, string|array<string|int, string> $helpID = null ][, bool $longLabel = false ]) : mixed
Parameters
- $name : string
-
unique name
- $checked : bool
-
checked
- $label : string
-
descriptive label
- $helpID : string|array<string|int, string> = null
-
help ID or array of help ID + module name (optional)
- $longLabel : bool = false
-
more space for label (default: false)
Return values
mixed —addDataAttribute()
Adds a data attribute.
public
addDataAttribute(string $key, string $value) : void
Parameters
- $key : string
-
attribute name (without "data-")
- $value : string
-
attribute value
Return values
void —generateHTML()
Prints the HTML code for this element.
public
generateHTML(mixed $module, mixed $input, mixed $values, mixed $restricted) : array<string, string>
Parameters
- $module : mixed
-
Name of account module
- $input : mixed
-
List of meta-HTML elements
- $values : mixed
-
List of values which override the defaults in $input (name => value)
- $restricted : mixed
-
If true then no buttons will be displayed
Return values
array<string, string> —List of input field names and their type (name => type)
getAccessibilityMarkup()
Returns the markup for the accessibility data.
public
getAccessibilityMarkup() : string
Return values
string —markup to be included in HTML tag (starting with space)
getAlignmentString()
Returns the HTML attributes for the alignment.
public
getAlignmentString() : string
Return values
string —alignment HTML attributes (e.g. align="right" valign="top")
getColspanString()
Returns the HTML attribute for the colspan.
public
getColspanString() : string
Return values
string —colspan HTML attribute (e.g. colspan=3)
getCSSClasses()
Returns the CSS classes of this element.
public
getCSSClasses() : array<string|int, string>|null
Return values
array<string|int, string>|null —$classes CSS class names
getRowspanString()
Returns the HTML attribute for the rowspan.
public
getRowspanString() : string
Return values
string —rowspan HTML attribute (e.g. rowspan=3)
getTableCellCSSClasses()
Returns the CSS classes of the surrounding table cell for this element.
public
getTableCellCSSClasses() : array<string|int, string>|null
Return values
array<string|int, string>|null —CSS classes
setAccessibilityLabel()
Sets the accessibility label.
public
setAccessibilityLabel(string|null $accessibilityLabel) : void
Parameters
- $accessibilityLabel : string|null
-
label
Return values
void —setCSSClasses()
Adds CSS classes to this element.
public
setCSSClasses(array<string|int, string>|null $classes) : void
Parameters
- $classes : array<string|int, string>|null
-
CSS class names
Return values
void —setElementsToDisable()
This will disable the given input elements when the checkbox is checked.
public
setElementsToDisable(array<string|int, string> $elements) : void
The given IDs can be of any input element (e.g. select, checkbox, ...).
Parameters
- $elements : array<string|int, string>
-
IDs of elements to disable
Return values
void —setElementsToEnable()
This will enable the given input elements when the checkbox is checked.
public
setElementsToEnable(array<string|int, string> $elements) : void
The given IDs can be of any input element (e.g. select, checkbox, ...).
Parameters
- $elements : array<string|int, string>
-
IDs of elements to enable
Return values
void —setIsEnabled()
Specifies if this component is enabled and accepts user modification.
public
setIsEnabled(bool $isEnabled) : void
Parameters
- $isEnabled : bool
-
enabled if true
Return values
void —setLabelAfterCheckbox()
Sets if the label should be shown after the checkbox instead before it.
public
setLabelAfterCheckbox([bool $labelAfterCheckbox = true ]) : void
Parameters
- $labelAfterCheckbox : bool = true
-
show label after box
Return values
void —setOnClick()
Sets the onclick code.
public
setOnClick(string $code) : void
Parameters
- $code : string
-
JS code
Return values
void —setShortLabel()
Use a short label (4 columns instead of 6) for tablet/desktop.
public
setShortLabel() : void
Return values
void —setTableCellCSSClasses()
Adds CSS classes to the surrounding table cell for this element.
public
setTableCellCSSClasses(array<string|int, string>|null $classes) : void
Parameters
- $classes : array<string|int, string>|null
-
CSS class names
Return values
void —setTableRowsToHide()
This will hide the given table rows when the checkbox is checked.
public
setTableRowsToHide(array<string|int, string> $tableRowsToHide) : void
The given IDs can be of any e.g. input element. Starting from this element the first parent "
Example:
Using "mycheckbox" will use this "tr" to hide/show.
Parameters
- $tableRowsToHide : array<string|int, string>
-
IDs of child elements to hide
Return values
void —setTableRowsToShow()
This will show the given table rows when the checkbox is checked.
public
setTableRowsToShow(array<string|int, string> $tableRowsToShow) : void
The given IDs can be of any e.g. input element. Starting from this element the first parent "
Example:
Using "mycheckbox" will use this "tr" to hide/show.
Parameters
- $tableRowsToShow : array<string|int, string>
-
IDs of child elements to show
Return values
void —setTitle()
Sets the title.
public
setTitle(string|null $title) : void
Parameters
- $title : string|null
-
title
Return values
void —setTransient()
Specifies that the value should not be automatically saved when used in self-service or server profile (default: false).
public
setTransient(bool $transient) : void
Parameters
- $transient : bool
-
transient field
Return values
void —getDataAttributesAsString()
Returns the data attributes as rendered string.
protected
getDataAttributesAsString() : string
Return values
string —data attributes
getName()
Returns the checkbox name.
protected
getName() : string
Return values
string —name
getShowHideSelector()
Returns the CSS selector to use to find show/hide elements.
protected
getShowHideSelector() : string