API16

JDispatcher/getInstance: Difference between revisions

From Joomla! Documentation

m clean up
m preparing for archive only
 
Line 36: Line 36:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=getInstance
  category=getInstance
  category=JDispatcher
  category=JDispatcher
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 01:30, 25 March 2017

Description

Returns the global Event Dispatcher object, only creating it if it doesn't already exist.


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

Syntax

static getInstance()


Returns

The EventDispatcher object. 

Defined in

libraries/joomla/event/dispatcher.php

Importing

jimport( 'joomla.event.dispatcher' );

Source Body

public static function getInstance()
{
        static $instance;

        if (!is_object($instance)) {
                $instance = new JDispatcher();
        }

        return $instance;
}


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

Examples

Code Examples