API16

JHtmlGrid/boolean

From Joomla! Documentation

< API16:JHtmlGrid

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Display a boolean setting widget.


<! removed transcluded page call, red link never existed >

Syntax[edit]

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[edit]

string The boolean setting widget.

Defined in[edit]

libraries/joomla/html/html/grid.php

Importing[edit]

jimport( 'joomla.html.html.grid' );

Source Body[edit]

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[edit]

Code Examples[edit]