API15

JEditor/getInstance: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 56: Line 56:


===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 00:32, 25 March 2017

Description

Returns a reference to a global Editor object, only creating it if it doesn't already exist.

[<! removed edit link to red link >]

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

Syntax

& 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

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 edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples