JEditor
Extends \JObjectJEditor class to handle WYSIWYG editors
This class allows for simple but smart objects with get and set methods and an internal error handler.
| package |
Joomla.Platform |
|---|---|
| subpackage |
HTML |
| since |
11.1 |
Methods
__construct
Class constructor, overridden in descendant classes.
__construct(mixed $properties = null)
| since |
11.1 |
|---|
Arguments
- $properties
mixedEither and associative array or another object to set the initial properties of the object.
__toString
Magic method to convert the object to a string gracefully.
__toString() : string
| since |
11.1 |
|---|---|
| deprecated |
12.3 Classes should provide their own __toString() implementation. |
Response
stringThe classname.
_loadEditor
Load the editor
_loadEditor(array $config = array()) : mixed
| since |
11.1 |
|---|
Arguments
- $config
arrayAssociative array of editor config paramaters
Response
mixed
attach
Attach an observer object
attach(object $observer) : void
| since |
11.1 |
|---|
Arguments
- $observer
objectAn observer object to attach
def
Sets a default value if not alreay assigned
def(string $property, mixed $default = null) : mixed
| since |
11.1 |
|---|
Arguments
- $property
stringThe name of the property.- $default
mixedThe default value.
Response
mixed
detach
Detach an observer object
detach(object $observer) : boolean
| since |
11.1 |
|---|
Arguments
- $observer
objectAn observer object to detach.
Response
booleanTrue if the observer object was detached.
display
Display the editor area.
display(string $name, string $html, string $width, string $height, integer $col, integer $row, boolean $buttons = true, string $id = null, string $asset = null, object $author = null, array $params = array()) : string
| since |
11.1 |
|---|
Arguments
- $name
stringThe control name.- $html
stringThe contents of the text area.- $width
stringThe width of the text area (px or %).- $height
stringThe height of the text area (px or %).- $col
integerThe number of columns for the textarea.- $row
integerThe number of rows for the textarea.- $buttons
booleanTrue and the editor buttons will be displayed.- $id
stringAn optional ID for the textarea (note: since 1.6). If not supplied the name is used.- $asset
stringThe object asset- $author
objectThe author.- $params
arrayAssociative array of editor parameters.
Response
string
get
Returns a property of the object or the default value if the property is not set.
get(string $property, mixed $default = null) : mixed
| since |
11.1 |
|---|---|
| see | \JObject::getProperties() |
Arguments
- $property
stringThe name of the property.- $default
mixedThe default value.
Response
mixedThe value of the property.
getButtons
Get the editor extended buttons (usually from plugins)
getButtons(string $editor, mixed $buttons = true) : array
| since |
11.1 |
|---|
Arguments
- $editor
stringThe name of the editor.- $buttons
mixedCan be boolean or array, if boolean defines if the buttons are displayed, if array defines a list of buttons not to show.
Response
array
getContent
Get the editor contents
getContent(string $editor) : string
| since |
11.1 |
|---|
Arguments
- $editor
stringThe name of the editor control
Response
string
getError
Get the most recent error message.
getError(integer $i = null, boolean $toString = true) : string
| since |
11.1 |
|---|---|
| see | \JError |
| deprecated |
12.3 JError has been deprecated |
Arguments
- $i
integerOption error index.- $toString
booleanIndicates if JError objects should return their error message.
Response
stringError message
getErrors
Return all errors, if any.
getErrors() : array
| since |
11.1 |
|---|---|
| see | \JError |
| deprecated |
12.3 JError has been deprecated |
Response
arrayArray of error messages or JErrors.
getInstance
Returns the global Editor object, only creating it if it doesn't already exist.
getInstance(string $editor = 'none') : object
| since |
11.1 |
|---|
Arguments
- $editor
stringThe editor to use.
Response
objectJEditor The Editor object.
getProperties
Returns an associative array of object properties.
getProperties(boolean $public = true) : array
| since |
11.1 |
|---|---|
| see | \JObject::get() |
Arguments
- $public
booleanIf true, returns only the public properties.
Response
array
getState
Get the state of the JEditor object
getState() : mixed
| since |
11.1 |
|---|
Response
mixedThe state of the object.
initialise
Initialise the editor
initialise() : void
| since |
11.1 |
|---|
save
Save the editor content
save(string $editor) : string
| since |
11.1 |
|---|
Arguments
- $editor
stringThe name of the editor control
Response
string
set
Modifies a property of the object, creating it if it does not already exist.
set(string $property, mixed $value = null) : mixed
| since |
11.1 |
|---|
Arguments
- $property
stringThe name of the property.- $value
mixedThe value of the property to set.
Response
mixedPrevious value of the property.
setContent
Set the editor contents
setContent(string $editor, string $html) : string
| since |
11.1 |
|---|
Arguments
- $editor
stringThe name of the editor control- $html
stringThe contents of the text area
Response
string
setError
Add an error message.
setError(string $error) : void
| since |
11.1 |
|---|---|
| see | \JError |
| deprecated |
12.3 JError has been deprecated |
Arguments
- $error
stringError message.
setProperties
Set the object properties based on a named array/hash.
setProperties(mixed $properties) : boolean
| since |
11.1 |
|---|---|
| see | \JObject::set() |
Arguments
- $properties
mixedEither an associative array or another object.
Response
boolean
toString
Converts the object to a string (the class name).
toString() : string
Properties
_observers
An array of Observer objects to notify
| since |
11.1 |
|---|
Type(s)
array
_state
The state of the observable object
| since |
11.1 |
|---|
Type(s)
mixed
_methods
A multi dimensional array of [function][] = key for observers
| since |
11.1 |
|---|
Type(s)
array
_editor
Editor Plugin object
Type(s)
object
_name
Editor Plugin name
Type(s)
string
asset
Object asset
Type(s)
string
author
Object author
Type(s)
string
instances
JEditor instances container.
| since |
11.3 |
|---|
Type(s)
array
_errors
An array of error messages or Exception objects.