API16

Difference between revisions of "JHtmlGrid/boolean"

From Joomla! Documentation

< API16:JHtmlGrid
(New page: ===Description=== Display a boolean setting widget. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</now...)
 
m (preparing for archive only)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
Display a boolean setting widget.
 
Display a boolean setting widget.
  
<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[Description:JHtmlGrid/boolean|Edit Descripton]]<nowiki>]</nowiki>
 
</span>
 
  
{{Description:JHtmlGrid/boolean}}
+
 
 +
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 68: Line 66:
 
</source>
 
</source>
  
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[</nowiki>[[SeeAlso:JHtmlGrid/boolean|Edit See Also]]<nowiki>]</nowiki>
+
<! removed transcluded page call, red link never existed >
</span>
 
{{SeeAlso:JHtmlGrid/boolean}}
 
  
 
===Examples===
 
===Examples===
<CodeExamplesForm />
+
=== Code Examples ===
 
<dpl>
 
<dpl>
 
  noresultsheader=\n
 
  noresultsheader=\n
 
  category=boolean
 
  category=boolean
 
  category=JHtmlGrid
 
  category=JHtmlGrid
  category=CodeExample
+
  namespace=CodeExample
 
  category=MethodExample
 
  category=MethodExample
 
  include=*
 
  include=*
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API16]]

Latest revision as of 20:45, 24 March 2017

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]