API16

Difference between revisions of "JHtmlBehavior/modal"

From Joomla! Documentation

< API16:JHtmlBehavior
(New page: <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> {{Description:JHtmlBehavior/modal}...)
 
m (removing red link to edit, no existant pages)
Line 1: Line 1:
 
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JHtmlBehavior/modal|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JHtmlBehavior/modal}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 88: Line 87:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JHtmlBehavior/modal|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JHtmlBehavior/modal}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 103: Line 102:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API16]]

Revision as of 21:56, 13 May 2013

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.

[<! removed edit link to red link >]

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

Syntax[edit]

static modal($selector='a.modal', $params=array())
Parameter Name Default Value Description
$selector 'a.modal'
$params array()

Defined in[edit]

libraries/joomla/html/html/behavior.php

Importing[edit]

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

Source Body[edit]

public static function modal($selector='a.modal', $params = array())
{
        static $modals;
        static $included;

        $document = &JFactory::getDocument();

        // Load the necessary files if they haven't yet been loaded
        if (!isset($included)) {
                // Load the javascript and css
                JHtml::_('behavior.framework');
                JHTML::_('script','system/modal.js', false, true);
                JHTML::_('stylesheet','system/modal.css', array(), true);

                $included = true;
        }

        if (!isset($modals)) {
                $modals = array();
        }

        $sig = md5(serialize(array($selector,$params)));
        if (isset($modals[$sig]) && ($modals[$sig])) {
                return;
        }

        // Setup options object
        $opt['ajaxOptions']     = (isset($params['ajaxOptions']) && (is_array($params['ajaxOptions']))) ? $params['ajaxOptions'] : null;
        $opt['size']            = (isset($params['size']) && (is_array($params['size']))) ? $params['size'] : null;
        $opt['shadow']          = (isset($params['shadow'])) ? $params['shadow'] : null;
        $opt['onOpen']          = (isset($params['onOpen'])) ? $params['onOpen'] : null;
        $opt['onClose']         = (isset($params['onClose'])) ? $params['onClose'] : null;
        $opt['onUpdate']        = (isset($params['onUpdate'])) ? $params['onUpdate'] : null;
        $opt['onResize']        = (isset($params['onResize'])) ? $params['onResize'] : null;
        $opt['onMove']          = (isset($params['onMove'])) ? $params['onMove'] : null;
        $opt['onShow']          = (isset($params['onShow'])) ? $params['onShow'] : null;
        $opt['onHide']          = (isset($params['onHide'])) ? $params['onHide'] : null;

        $options = JHtmlBehavior::_getJSObject($opt);

        // Attach modal behavior to document
        $document->addScriptDeclaration("
        window.addEvent('domready', function() {

                SqueezeBox.initialize(".$options.");
                SqueezeBox.assign($$('".$selector."'), {
                        parse: 'rel'
                });
        });");

        // Set static array
        $modals[$sig] = true;
        return;
}

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

Examples[edit]

<CodeExamplesForm />