Actions

API16

JHtmlGrid/boolean

From Joomla! Documentation

< API16:JHtmlGrid
Revision as of 17:51, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Display a boolean setting widget.

[Edit Descripton]

Description:JHtmlGrid/boolean

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;
}

[Edit See Also] SeeAlso:JHtmlGrid/boolean

Examples

<CodeExamplesForm />