API16:JHtmlGrid/boolean
From Joomla! Documentation
Description
Display a boolean setting widget.
<! removed transcluded page call, red link never existed >
Syntax
static boolean($i, $value, $taskOn=null, $taskOff=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $i | The row index. | |
| $value | The value of the boolean field. | |
| $taskOn | null | Task to turn the boolean setting on. |
| $taskOff | null | Task to turn the boolean setting off. |
Returns
string The boolean setting widget.
Defined in
libraries/joomla/html/html/grid.php
Importing
jimport( 'joomla.html.html.grid' );
Source Body
static function boolean($i, $value, $taskOn = null, $taskOff = null)
{
// Load the behavior.
self::behavior();
// Build the title.
$title = ($value) ? JText::_('JYes') : JText::_('JNo');
$title .= '::'.JText::_('Click_To_Toggle');
// Build the <a> tag.
$bool = ($value) ? 'true' : 'false';
$task = ($value) ? $taskOff : $taskOn;
$toggle = (!$task) ? false : true;
if ($toggle) {
$html = '<a class="grid_'.$bool.' hasTip" title="'.$title.'" rel="{id:\'cb'.$i.'\', task:\''.$task.'\'}" href="#toggle"></a>';
} else {
$html = '<a class="grid_'.$bool.'" rel="{id:\'cb'.$i.'\', task:\''.$task.'\'}"></a>';
}
return $html;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples