Class form_wysiwygfield

Description

Wysiwyg Field class A field which renders a textarea form element as a Wysiwyg editor.

This is based on the package 'HTMLarea', by Mihai Bazon. This class leverages the standard memofield. In fact we render a standard memofield, and the main diference is only the setting of a classid, and rendering the javascript for HTMLarea to initialisei itself.

Located in /htmlarea-defs.php (line 429)

RenderableObject
   |
   --StylableObject
      |
      --HTMLObject
         |
         --form_field
            |
            --form_textfield
               |
               --form_memofield
                  |
                  --form_wysiwygfield
Variable Summary
 mixed $config
 mixed $css_styles
 mixed $plugins
 mixed $wysiwyg_id
Method Summary
 form_wysiwygfield form_wysiwygfield ([string $name = ""], [string $label = ""], [string $value = ""], [boolean $editable = EDITABLE], [string $css = ""], [integer $width = STD_WIDTH], [integer $rows = 5])
 string html ([mixed $name = ""])
 void register_plugins ([string $pluginlist = "all"])
 void set_blockformats (array $new_blockformats)
 void set_fontnames (array $new_fontnames)
 void set_fontsizes (mixed $new_fontsizes, array $new_blocksizes)
 void set_metrics ([string $width = ""], [string $height = ""], [boolean $inctoolbar = true])
 void set_pagestyle (string $css_style)
 void set_paste_intercept ([boolean $mode = true])
 void set_remove_regex ([string $regex = ""])
 void set_statusbar ([boolean $mode = true])
 void set_styles (mixed $new_styles, [string $mode = "replace"])
 void set_toolbar (mixed $new_toolbar, mixed $new_toolbat)
 void set_undo_steps ([integer $steps = 20])
Variables
mixed $config (line 442)

The configuration override settings to use. This is

mixed $css_styles (line 438)

CSS Styles we want to display for this field

mixed $plugins = array() (line 435)

Plugins we want to register for this field

mixed $wysiwyg_id = "wysiwyg" (line 432)

Unique ID of this form element

Inherited Variables

Inherited from form_memofield

form_memofield::$rows
form_memofield::$wrapmode

Inherited from form_textfield

form_textfield::$format
form_textfield::$maxlength

Inherited from form_field

form_field::$autocomplete
form_field::$disabled
form_field::$editable
form_field::$label
form_field::$type
form_field::$value

Inherited from HTMLObject

HTMLObject::$accesskey
HTMLObject::$align
HTMLObject::$alt
HTMLObject::$bgcolor
HTMLObject::$bgurl
HTMLObject::$border
HTMLObject::$color
HTMLObject::$height
HTMLObject::$hspace
HTMLObject::$lang
HTMLObject::$langdir
HTMLObject::$linkover_text
HTMLObject::$name
HTMLObject::$onblur
HTMLObject::$onchange
HTMLObject::$onclick
HTMLObject::$ondblclick
HTMLObject::$onfocus
HTMLObject::$onkeydown
HTMLObject::$onkeypress
HTMLObject::$onkeyup
HTMLObject::$onload
HTMLObject::$onmousedown
HTMLObject::$onmousemove
HTMLObject::$onmouseout
HTMLObject::$onmouseover
HTMLObject::$onmouseup
HTMLObject::$onselect
HTMLObject::$size
HTMLObject::$src
HTMLObject::$tabindex
HTMLObject::$target
HTMLObject::$title
HTMLObject::$user_attributes
HTMLObject::$valign
HTMLObject::$vspace
HTMLObject::$width

Inherited from StylableObject

StylableObject::$class
StylableObject::$id
StylableObject::$style
Methods
Constructor form_wysiwygfield (line 453)

Constructor - create a wysiwyg form element..

form_wysiwygfield form_wysiwygfield ([string $name = ""], [string $label = ""], [string $value = ""], [boolean $editable = EDITABLE], [string $css = ""], [integer $width = STD_WIDTH], [integer $rows = 5])
  • string $name: The name of the field
  • string $label: The label which can be displayed alongside the field
  • string $value: The value of the field
  • boolean $editable: Editability: EDITABLE or DISPLAY_ONLY (true or false)
  • string $css: CSS class or style to apply to the button
  • integer $width: Width of the memo field in characters
  • integer $rows: Height of the memo field in lines
html (line 698)

This renders the field as HTML.

  • return: The wysiwyg HTMLArea editor field as HTML.
string html ([mixed $name = ""])

Redefinition of:
form_memofield::html()
This renders the field as HTML.
register_plugins (line 612)

Set the plugins to register for this Wysiwyg editor. This is a subset

of the allowed plugins which were given in the original call to the

  • see: htmlarea_plugins() function. If you want to just register all of the possibilities, then just leave the argument list empty, or explicitly set it to "all" (the default).
void register_plugins ([string $pluginlist = "all"])
  • string $pluginlist: Comma-delimited list of plugins to register
set_blockformats (line 548)

Set a new list of selectable block formats. The array should be an

associative one in the form: "Heading 1" => "h1", "Heading 2" => "h2", ...

void set_blockformats (array $new_blockformats)
  • array $new_blockformats: Array of block formats to use
set_fontnames (line 522)

Set a new list of selectable font families. This array should be an

associative one in the form: "Arial" => "arial,helvetica,sans-serif", "Courier New" => "courier new,courier,monospace", ...

void set_fontnames (array $new_fontnames)
  • array $new_fontnames: Array of font family names to use
set_fontsizes (line 535)

Set a new list of selectable font sizes. The sizes array should be

an associative one in the form: "1 (8 pt)" => "1", "2 (10 pt)" => "2", ...

void set_fontsizes (mixed $new_fontsizes, array $new_blocksizes)
  • array $new_blocksizes: Array of font sizes to use
set_metrics (line 561)

Set the HTMLArea sizing. The default is 'auto' for both width and height, which gives you an editing area filling the are that the original memofield widget would have filled.

void set_metrics ([string $width = ""], [string $height = ""], [boolean $inctoolbar = true])
  • string $width: Width of the HTMLArea editor
  • string $height: Height of the HTMLArea editor
  • boolean $inctoolbar: Whether sizing includes the toolbar
set_pagestyle (line 496)

Set the HTMLArea page style. This is the overall style setting(s) which are applied to the HTMLArea widget and so here is where you determine such basic things as the font settings of the content which is displayed/edited etc.

void set_pagestyle (string $css_style)
  • string $css_style: The style setting for the editor 'page'
set_paste_intercept (line 600)

Set the HTMLArea Paste mode. If set to true, then the HTMLArea

widget will intercept ^V and use the HTMLArea paste command. If false, then it passes ^V through to browser editor widget

void set_paste_intercept ([boolean $mode = true])
  • boolean $mode: Whether to intercept ^V or not
set_remove_regex (line 576)

Set the regular expression to use for removing dis-allowed HTML tags from the editor content. This allows you to specify a regex matching those tags you don't want to ever appear in the content.

void set_remove_regex ([string $regex = ""])
  • string $regex: Regular expression matching disallowed tags
set_statusbar (line 591)

Set the HTMLArea statusbar display mode, true or false.

void set_statusbar ([boolean $mode = true])
  • boolean $mode: Whether to display the statusbar or not
set_styles (line 475)

Set the styles to provide for this Wysiwyg editor. Styles are displayed

when you register the "CSS" plugin. This method either replaces (the default action) or appends the given list (or array) of styles to the editor. Pass the styles list either as a comma-delimited string, or an array. Each style should be in the format 'label : classname' as shown in this example: 'Light background : axbglite' (You should omit the quotes, which are just to delimit the example)

void set_styles (mixed $new_styles, [string $mode = "replace"])
  • mixed $new_styles: Comma-delimited list or array of style definitions
  • string $mode: If "append" add styles to existing, else replace
set_toolbar (line 511)

Set a new toolbar definition. Toolbars are arrays of arrays of lists

of HTMLArea widgets. Each array is a line of these widgets. For an example see the default setting for the toolbar in this class. You can EITHER give a full toolbar definition here as an array of arrays of toolbar widgets, OR give a preset toolbar ID string. Presets that we have defined so far are: "basic" - Just enough to enter text, bold/italic etc. "medium" - As above but with colour, links, raw HTML etc. "full" - Everything available

void set_toolbar (mixed $new_toolbar, mixed $new_toolbat)
  • mixed $new_toolbat: Array of toolbar lines, or preset toolbar id
set_undo_steps (line 584)

Set the HTMLArea undo steps maximum. The default number is 20. Use this method to change that.

void set_undo_steps ([integer $steps = 20])
  • integer $steps: Number of undo steps to record.

Inherited Methods

Inherited From form_memofield

 form_memofield::form_memofield()
 form_memofield::html()
 form_memofield::set_rows()
 form_memofield::set_wrapmode()

Inherited From form_textfield

 form_textfield::form_textfield()
 form_textfield::html()
 form_textfield::set_format()
 form_textfield::set_width()
 form_textfield::wml()

Inherited From form_field

 form_field::form_field()
 form_field::as_displayonly()
 form_field::as_hiddenfield()
 form_field::disable_autocomplete()
 form_field::setlabel()
 form_field::setvalue()
 form_field::set_displayonly()

Inherited From HTMLObject

 HTMLObject::HTMLObject()
 HTMLObject::inherit_attributes()
 HTMLObject::setaccesskey()
 HTMLObject::setalign()
 HTMLObject::setalt()
 HTMLObject::setbackground()
 HTMLObject::setbgcolor()
 HTMLObject::setborder()
 HTMLObject::setcolor()
 HTMLObject::setheight()
 HTMLObject::sethspace()
 HTMLObject::setlang()
 HTMLObject::setlangdir()
 HTMLObject::setname()
 HTMLObject::setsize()
 HTMLObject::setsrc()
 HTMLObject::settabindex()
 HTMLObject::settarget()
 HTMLObject::settitle()
 HTMLObject::setvalign()
 HTMLObject::setvspace()
 HTMLObject::setwidth()
 HTMLObject::set_attribute()
 HTMLObject::set_linkover_text()
 HTMLObject::set_onblur()
 HTMLObject::set_onchange()
 HTMLObject::set_onclick()
 HTMLObject::set_ondblclick()
 HTMLObject::set_onfocus()
 HTMLObject::set_onkeydown()
 HTMLObject::set_onkeypress()
 HTMLObject::set_onkeyup()
 HTMLObject::set_onload()
 HTMLObject::set_onmousedown()
 HTMLObject::set_onmousemove()
 HTMLObject::set_onmouseout()
 HTMLObject::set_onmouseover()
 HTMLObject::set_onmouseup()
 HTMLObject::set_onselect()
 HTMLObject::set_tabindex()
 HTMLObject::taghtml()

Inherited From StylableObject

 StylableObject::StylableObject()
 StylableObject::clearstyle()
 StylableObject::setclass()
 StylableObject::setcss()
 StylableObject::setid()
 StylableObject::setstyle()

Inherited From RenderableObject

 RenderableObject::RenderableObject()
 RenderableObject::html()
 RenderableObject::render()
 RenderableObject::wml()
 RenderableObject::wmlup()
 RenderableObject::xml()

Documentation generated by phpDocumentor 1.3.0RC3