API16

JHtml/tooltip: Difference between revisions

From Joomla! Documentation

Royce (talk | contribs)
Syntax: Minor misspelling - depreciated != deprecated
m removing red link to edit, no existant pages
Line 3: Line 3:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JHtml/tooltip|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JHtml/tooltip}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 87: Line 87:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JHtml/tooltip|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JHtml/tooltip}}
<! removed transcluded page call, red link never existed >


===Examples===
===Examples===
Line 102: Line 102:
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API16]]

Revision as of 02:55, 14 May 2013

Description

Creates a tooltip with an image as button

[<! removed edit link to red link >]

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

Syntax

static tooltip($tooltip, $title= '', $image= 'tooltip.png', $text= '', $href= '', $link=1)
Parameter Name Default Value Description
$tooltip $tooltip The tip string
$title $title The title of the tooltip
$image 'tooltip.png' $image The image for the tip, if no text is provided
$text $text The text for the tip
$href $href An URL that will be used to create the link
$link 1 deprecated

Returns

string

Defined in

libraries/joomla/html/html.php

Importing

jimport( 'joomla.html.html' );

Source Body

public static function tooltip(
        $tooltip, $title = '', $image = 'tooltip.png', $text = '', $href = '', $link = 1
)
{
        $tooltip        = addslashes(htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8'));
        $title          = addslashes(htmlspecialchars($title, ENT_COMPAT, 'UTF-8'));

        if (!$text) {
                $image  = JURI::root(true).'/includes/js/ThemeOffice/'. $image;
                $text   = '<img src="'. $image .'" border="0" alt="'. JText::_('Tooltip') .'"/>';
        } else {
                $text   = JText::_($text, true);
        }

        if ($title) {
                $title .= '::';
        }

        $style = 'style="text-decoration: none; color: #333;"';

        $tip = '<span class="editlinktip hasTip" title="' . $title . $tooltip . '" '
                . $style . '>';
        if ($href) {
                $href = JRoute::_($href);
                $style = '';
                $tip .= '<a href="' . $href . '">' . $text . '</a></span>';
        } else {
                $tip .= $text . '</span>';
        }

        return $tip;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />