API16

JHtml/tooltip

From Joomla! Documentation

< API16:JHtml
Revision as of 16:45, 26 June 2011 by Royce (talk | contribs) (→‎Syntax: Minor misspelling - depreciated != deprecated)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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]

Creates a tooltip with an image as button

[Edit Descripton]

Template:Description:JHtml/tooltip

Syntax[edit]

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

string

Defined in[edit]

libraries/joomla/html/html.php

Importing[edit]

jimport( 'joomla.html.html' );

Source Body[edit]

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

[Edit See Also] Template:SeeAlso:JHtml/tooltip

Examples[edit]

<CodeExamplesForm />