API16

JEditor/getInstance: Difference between revisions

From Joomla! Documentation

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


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

Latest revision as of 01:34, 25 March 2017

Description

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


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

Syntax

static getInstance($editor= 'none')
Parameter Name Default Value Description
$editor 'none' $editor The editor to use.

Returns

The Editor object. 

Defined in

libraries/joomla/html/editor.php

Importing

jimport( 'joomla.html.editor' );

Source Body

public static function getInstance($editor = 'none')
{
        static $instances;

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

        $signature = serialize($editor);

        if (empty ($instances[$signature])) {
                $instances[$signature] = new JEditor($editor);
        }

        return $instances[$signature];
}


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

Examples

Code Examples