Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
MoodleQuickForm_editor Class Reference

Editor element. More...

Inheritance diagram for MoodleQuickForm_editor:
templatable

Public Member Functions

 __construct ($elementName=null, $elementLabel=null, $attributes=null, $options=null)
 Constructor.
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 get_text ()
 Returns editor text content.
 
 getAreamaxbytes ()
 Returns the maximum size of the area.
 
 getElementTemplateType ()
 Returns type of editor element.
 
 getFormat ()
 Returns editor format.
 
 getFrozenHtml ()
 Returns the formatted value.
 
 getHelpButton ()
 Returns html for help button.
 
 getMaxbytes ()
 Returns maximum file size which can be uploaded.
 
 getMaxfiles ()
 Returns maximum number of files which can be uploaded.
 
 getName ()
 Returns name of element.
 
 getSubdirs ()
 Returns true if subdirectoy can be created, else false.
 
 getValue ()
 Returns editor values.
 
 isRequired ()
 Checks if editor used is a required field.
 
 MoodleQuickForm_editor ($elementName=null, $elementLabel=null, $attributes=null, $options=null)
 Old syntax of class constructor.
 
 onQuickFormEvent ($event, $arg, &$caller)
 Called by HTML_QuickForm whenever form event is made on this element.
 
 setAreamaxbytes ($areamaxbytes)
 Sets the maximum size of the area.
 
 setHelpButton ($_helpbuttonargs, $function='_helpbutton')
 
 setHiddenLabel ($hiddenLabel)
 Sets label to be hidden.
 
 setMaxbytes ($maxbytes)
 Sets maximum file size which can be uploaded.
 
 setMaxfiles ($num)
 Sets maximum number of files which can be uploaded.
 
 setName ($name)
 Sets name of editor.
 
 setSubdirs ($allow)
 Set option to create sub directory, while uploading file.
 
 setValue ($values)
 Updates editor values, if part of $_values.
 
 toHtml ()
 Returns HTML for editor form element.
 

Public Attributes

string $_helpbutton = ''
 html for help button, if empty then no help will icon will be dispalyed.
 
string $_type = 'editor'
 defines the type of editor
 

Protected Attributes

bool $_hiddenLabel = false
 if true label will be hidden
 
array $_options
 options provided to initalize filepicker
 
array $_values = array('text'=>null, 'format'=>null, 'itemid'=>null)
 values for editor
 

Detailed Description

Editor element.

It creates preffered editor (textbox/Tiny) form element for the format (Text/HTML) selected.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Todo

MDL-29421 element Freezing

MDL-29426 ajax format conversion

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_editor::__construct ( $elementName = null,
$elementLabel = null,
$attributes = null,
$options = null )

Constructor.

Parameters
string$elementName(optional) name of the editor
string$elementLabel(optional) editor label
array$attributes(optional) Either a typical HTML attribute string or an associative array
array$optionsset of options to initalize filepicker

Member Function Documentation

◆ export_for_template()

MoodleQuickForm_editor::export_for_template ( renderer_base $output)

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implements templatable.

◆ get_text()

MoodleQuickForm_editor::get_text ( )

Returns editor text content.

Return values
stringText content

◆ getAreamaxbytes()

MoodleQuickForm_editor::getAreamaxbytes ( )

Returns the maximum size of the area.

Return values
int

◆ getElementTemplateType()

MoodleQuickForm_editor::getElementTemplateType ( )

Returns type of editor element.

Return values
string

◆ getFormat()

MoodleQuickForm_editor::getFormat ( )

Returns editor format.

Return values
int.

◆ getFrozenHtml()

MoodleQuickForm_editor::getFrozenHtml ( )

Returns the formatted value.

The return from parent class is not acceptable.

Return values
string

◆ getHelpButton()

MoodleQuickForm_editor::getHelpButton ( )

Returns html for help button.

Return values
stringhtml for help button

◆ getMaxbytes()

MoodleQuickForm_editor::getMaxbytes ( )

Returns maximum file size which can be uploaded.

Return values
int

◆ getMaxfiles()

MoodleQuickForm_editor::getMaxfiles ( )

Returns maximum number of files which can be uploaded.

Return values
int

◆ getName()

MoodleQuickForm_editor::getName ( )

Returns name of element.

Return values
string

◆ getSubdirs()

MoodleQuickForm_editor::getSubdirs ( )

Returns true if subdirectoy can be created, else false.

Return values
bool

◆ getValue()

MoodleQuickForm_editor::getValue ( )

Returns editor values.

Return values
array

◆ isRequired()

MoodleQuickForm_editor::isRequired ( )

Checks if editor used is a required field.

Return values
booltrue if required field.

◆ MoodleQuickForm_editor()

MoodleQuickForm_editor::MoodleQuickForm_editor ( $elementName = null,
$elementLabel = null,
$attributes = null,
$options = null )

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated
since Moodle 3.1

◆ onQuickFormEvent()

MoodleQuickForm_editor::onQuickFormEvent ( $event,
$arg,
& $caller )

Called by HTML_QuickForm whenever form event is made on this element.

Parameters
string$eventName of event
mixed$argevent arguments
object$callercalling object
Return values
bool

◆ setAreamaxbytes()

MoodleQuickForm_editor::setAreamaxbytes ( $areamaxbytes)

Sets the maximum size of the area.

Parameters
int$areamaxbytessize limit

◆ setHelpButton()

MoodleQuickForm_editor::setHelpButton ( $_helpbuttonargs,
$function = '_helpbutton' )
Deprecated
since Moodle 2.0

◆ setHiddenLabel()

MoodleQuickForm_editor::setHiddenLabel ( $hiddenLabel)

Sets label to be hidden.

Parameters
bool$hiddenLabelWhether the label should be hidden or not.
Return values
void

◆ setMaxbytes()

MoodleQuickForm_editor::setMaxbytes ( $maxbytes)

Sets maximum file size which can be uploaded.

Parameters
int$maxbytesfile size

◆ setMaxfiles()

MoodleQuickForm_editor::setMaxfiles ( $num)

Sets maximum number of files which can be uploaded.

Parameters
int$numnumber of files

◆ setName()

MoodleQuickForm_editor::setName ( $name)

Sets name of editor.

Parameters
string$namename of the editor

◆ setSubdirs()

MoodleQuickForm_editor::setSubdirs ( $allow)

Set option to create sub directory, while uploading file.

Parameters
bool$allowtrue if sub directory can be created.

◆ setValue()

MoodleQuickForm_editor::setValue ( $values)

Updates editor values, if part of $_values.

Parameters
array$valuesassociative array of values to set

◆ toHtml()

MoodleQuickForm_editor::toHtml ( )

Returns HTML for editor form element.

Return values
string

Member Data Documentation

◆ $_options

array MoodleQuickForm_editor::$_options
protected
Initial value:
= array('subdirs' => 0, 'maxbytes' => 0, 'maxfiles' => 0, 'changeformat' => 0,
'areamaxbytes' => FILE_AREA_MAX_BYTES_UNLIMITED, 'context' => null, 'noclean' => 0, 'trusttext' => 0,
'return_types' => 15, 'enable_filemanagement' => true, 'removeorphaneddrafts' => false, 'autosave' => true)
const FILE_AREA_MAX_BYTES_UNLIMITED
Unlimited area size constant.
Definition filelib.php:41

options provided to initalize filepicker


The documentation for this class was generated from the following file: